Date: (Tue) May 31, 2016
Data: Source: Training: “https://inclass.kaggle.com/c/can-we-predict-voting-outcomes/download/train2016.csv”
New: “https://inclass.kaggle.com/c/can-we-predict-voting-outcomes/download/test2016.csv”
Time period:
Based on analysis utilizing <> techniques,
Summary of key steps & error improvement stats:
Use plot.ly for interactive plots ?
varImp for randomForest crashes in caret version:6.0.41 -> submit bug report
extensions toward multiclass classification are scheduled for the next release
rm(list = ls())
set.seed(12345)
options(stringsAsFactors = FALSE)
source("~/Dropbox/datascience/R/mycaret.R")
source("~/Dropbox/datascience/R/mydsutils.R")
## Loading required package: caret
## Loading required package: lattice
## Loading required package: ggplot2
source("~/Dropbox/datascience/R/mypetrinet.R")
source("~/Dropbox/datascience/R/myplclust.R")
source("~/Dropbox/datascience/R/myplot.R")
source("~/Dropbox/datascience/R/myscript.R")
source("~/Dropbox/datascience/R/mytm.R")
# Gather all package requirements here
suppressPackageStartupMessages(require(doMC))
glbCores <- 6 # of cores on machine - 2
registerDoMC(glbCores)
suppressPackageStartupMessages(require(caret))
require(plyr)
## Loading required package: plyr
require(dplyr)
## Loading required package: dplyr
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:plyr':
##
## arrange, count, desc, failwith, id, mutate, rename, summarise,
## summarize
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
require(knitr)
## Loading required package: knitr
require(stringr)
## Loading required package: stringr
#source("dbgcaret.R")
#packageVersion("snow")
#require(sos); findFn("cosine", maxPages=2, sortby="MaxScore")
# Analysis control global variables
# Inputs
# url/name = "<PathPointer>"; if url specifies a zip file, name = "<filename>";
# or named collection of <PathPointer>s
# sep = choose from c(NULL, "\t")
glbObsTrnFile <- list(url = "https://inclass.kaggle.com/c/can-we-predict-voting-outcomes/download/train2016.csv"
# or list(url = c(NULL, <.inp1> = "<path1>", <.inp2> = "<path2>"))
#, splitSpecs = list(method = "copy" # default when glbObsNewFile is NULL
# select from c("copy", NULL ???, "condition", "sample", )
# ,nRatio = 0.3 # > 0 && < 1 if method == "sample"
# ,seed = 123 # any integer or glbObsTrnPartitionSeed if method == "sample"
# ,condition = # or 'is.na(<var>)'; '<var> <condition_operator> <value>'
# )
)
glbObsNewFile <- list(url = "https://inclass.kaggle.com/c/can-we-predict-voting-outcomes/download/test2016.csv")
glbObsDropCondition <- NULL # : default
# enclose in single-quotes b/c condition might include double qoutes
# use | & ; NOT || &&
# '<condition>'
# 'grepl("^First Draft Video:", glbObsAll$Headline)'
# 'is.na(glbObsAll[, glb_rsp_var_raw])'
# '(is.na(glbObsAll[, glb_rsp_var_raw]) & grepl("Train", glbObsAll[, glbFeatsId]))'
# 'is.na(strptime(glbObsAll[, "Date"], glbFeatsDateTime[["Date"]]["format"], tz = glbFeatsDateTime[["Date"]]["timezone"]))'
#nrow(do.call("subset",list(glbObsAll, parse(text=paste0("!(", glbObsDropCondition, ")")))))
glb_obs_repartition_train_condition <- NULL # : default
# "<condition>"
glb_max_fitobs <- NULL # or any integer
glbObsTrnPartitionSeed <- 123 # or any integer
glb_is_regression <- FALSE; glb_is_classification <- !glb_is_regression;
glb_is_binomial <- TRUE # or TRUE or FALSE
glb_rsp_var_raw <- "Party"
# for classification, the response variable has to be a factor
glb_rsp_var <- "Party.fctr"
# if the response factor is based on numbers/logicals e.g (0/1 OR TRUE/FALSE vs. "A"/"B"),
# or contains spaces (e.g. "Not in Labor Force")
# caret predict(..., type="prob") crashes
glb_map_rsp_raw_to_var <- #NULL
function(raw) {
# return(raw ^ 0.5)
# return(log(raw))
# return(log(1 + raw))
# return(log10(raw))
# return(exp(-raw / 2))
ret_vals <- rep_len(NA, length(raw)); ret_vals[!is.na(raw)] <- ifelse(raw[!is.na(raw)] == "Republican", "R", "D"); return(relevel(as.factor(ret_vals), ref = "R"))
# as.factor(paste0("B", raw))
# as.factor(gsub(" ", "\\.", raw))
}
#if glb_rsp_var_raw is numeric:
#print(summary(glbObsAll[, glb_rsp_var_raw]))
#glb_map_rsp_raw_to_var(tst <- c(NA, as.numeric(summary(glbObsAll[, glb_rsp_var_raw]))))
#if glb_rsp_var_raw is character:
#print(table(glbObsAll[, glb_rsp_var_raw], useNA = "ifany"))
# print(table(glb_map_rsp_raw_to_var(tst <- glbObsAll[, glb_rsp_var_raw]), useNA = "ifany"))
glb_map_rsp_var_to_raw <- #NULL
function(var) {
# return(var ^ 2.0)
# return(exp(var))
# return(10 ^ var)
# return(-log(var) * 2)
# as.numeric(var)
# levels(var)[as.numeric(var)]
sapply(levels(var)[as.numeric(var)], function(elm)
if (is.na(elm)) return(elm) else
if (elm == 'R') return("Republican") else
if (elm == 'D') return("Democrat") else
stop("glb_map_rsp_var_to_raw: unexpected value: ", elm)
)
# gsub("\\.", " ", levels(var)[as.numeric(var)])
# c("<=50K", " >50K")[as.numeric(var)]
# c(FALSE, TRUE)[as.numeric(var)]
}
# print(table(glb_map_rsp_var_to_raw(glb_map_rsp_raw_to_var(tst)), useNA = "ifany"))
if ((glb_rsp_var != glb_rsp_var_raw) && is.null(glb_map_rsp_raw_to_var))
stop("glb_map_rsp_raw_to_var function expected")
# List info gathered for various columns
# <col_name>: <description>; <notes>
# USER_ID - an anonymous id unique to a given user
# YOB - the year of birth of the user
# Gender - the gender of the user, either Male or Female
# Income - the household income of the user. Either not provided, or one of "under $25,000", "$25,001 - $50,000", "$50,000 - $74,999", "$75,000 - $100,000", "$100,001 - $150,000", or "over $150,000".
# HouseholdStatus - the household status of the user. Either not provided, or one of "Domestic Partners (no kids)", "Domestic Partners (w/kids)", "Married (no kids)", "Married (w/kids)", "Single (no kids)", or "Single (w/kids)".
# EducationalLevel - the education level of the user. Either not provided, or one of "Current K-12", "High School Diploma", "Current Undergraduate", "Associate's Degree", "Bachelor's Degree", "Master's Degree", or "Doctoral Degree".
# Party - the political party for whom the user intends to vote for. Either "Democrat" or "Republican
# Q124742, Q124122, . . . , Q96024 - 101 different questions that the users were asked on Show of Hands. If the user didn't answer the question, there is a blank. For information about the question text and possible answers, see the file Questions.pdf.
# currently does not handle more than 1 column; consider concatenating multiple columns
# If glbFeatsId == NULL, ".rownames <- as.numeric(row.names())" is the default
glbFeatsId <- "USER_ID" # choose from c(NULL : default, "<id_feat>")
# glbFeatsCategory <- "Hhold.fctr" # choose from c(NULL : default, "<category_feat>")
glbFeatsCategory <- "Q109244.fctr" # choose from c(NULL : default, "<category_feat>") -> OOB performed worse than "Hhold.fctr"
# User-specified exclusions
glbFeatsExclude <- c(NULL
# Feats that shd be excluded due to known causation by prediction variable
# , "<feat1", "<feat2>"
# Feats that are factors with unique values (as % of nObs) > 49 (empirically derived)
# Feats that are linear combinations (alias in glm)
# Feature-engineering phase -> start by excluding all features except id & category &
# work each one in
, "USER_ID", "YOB", "Gender", "Income", "HouseholdStatus", "EducationLevel"
,"Q124742","Q124122"
,"Q123621","Q123464"
,"Q122771","Q122770","Q122769","Q122120"
,"Q121700","Q121699","Q121011"
,"Q120978","Q120650","Q120472","Q120379","Q120194","Q120014","Q120012"
,"Q119851","Q119650","Q119334"
,"Q118892","Q118237","Q118233","Q118232","Q118117"
,"Q117193","Q117186"
,"Q116797","Q116881","Q116953","Q116601","Q116441","Q116448","Q116197"
,"Q115602","Q115777","Q115610","Q115611","Q115899","Q115390","Q115195"
,"Q114961","Q114748","Q114517","Q114386","Q114152"
,"Q113992","Q113583","Q113584","Q113181"
,"Q112478","Q112512","Q112270"
,"Q111848","Q111580","Q111220"
,"Q110740"
,"Q109367","Q109244"
,"Q108950","Q108855","Q108617","Q108856","Q108754","Q108342","Q108343"
,"Q107869","Q107491"
,"Q106993","Q106997","Q106272","Q106388","Q106389","Q106042"
,"Q105840","Q105655"
,"Q104996"
,"Q103293"
,"Q102906","Q102674","Q102687","Q102289","Q102089"
,"Q101162","Q101163","Q101596"
,"Q100689","Q100680","Q100562","Q100010"
,"Q99982"
,"Q99716"
,"Q99581"
,"Q99480"
,"Q98869"
,"Q98578"
,"Q98197"
,"Q98059","Q98078"
,"Q96024" # Done
,".pos")
if (glb_rsp_var_raw != glb_rsp_var)
glbFeatsExclude <- union(glbFeatsExclude, glb_rsp_var_raw)
glbFeatsInteractionOnly <- list()
#glbFeatsInteractionOnly[["<child_feat>"]] <- "<parent_feat>"
glbFeatsInteractionOnly[["YOB.Age.dff"]] <- "YOB.Age.fctr"
glbFeatsDrop <- c(NULL
# , "<feat1>", "<feat2>"
)
glb_map_vars <- NULL # or c("<var1>", "<var2>")
glb_map_urls <- list();
# glb_map_urls[["<var1>"]] <- "<var1.url>"
# Derived features; Use this mechanism to cleanse data ??? Cons: Data duplication ???
glbFeatsDerive <- list();
# glbFeatsDerive[["<feat.my.sfx>"]] <- list(
# mapfn = function(<arg1>, <arg2>) { return(function(<arg1>, <arg2>)) }
# , args = c("<arg1>", "<arg2>"))
#myprint_df(data.frame(ImageId = mapfn(glbObsAll$.src, glbObsAll$.pos)))
#data.frame(ImageId = mapfn(glbObsAll$.src, glbObsAll$.pos))[7045:7055, ]
# character
# mapfn = function(Education) { raw <- Education; raw[is.na(raw)] <- "NA.my"; return(as.factor(raw)) }
# mapfn = function(Week) { return(substr(Week, 1, 10)) }
# mapfn = function(Name) { return(sapply(Name, function(thsName)
# str_sub(unlist(str_split(thsName, ","))[1], 1, 1))) }
# mapfn = function(descriptor) { return(plyr::revalue(descriptor, c(
# "ABANDONED BUILDING" = "OTHER",
# "**" = "**"
# ))) }
# mapfn = function(description) { mod_raw <- description;
# This is here because it does not work if it's in txt_map_filename
# mod_raw <- gsub(paste0(c("\n", "\211", "\235", "\317", "\333"), collapse = "|"), " ", mod_raw)
# Don't parse for "." because of ".com"; use customized gsub for that text
# mod_raw <- gsub("(\\w)(!|\\*|,|-|/)(\\w)", "\\1\\2 \\3", mod_raw);
# Some state acrnoyms need context for separation e.g.
# LA/L.A. could either be "Louisiana" or "LosAngeles"
# modRaw <- gsub("\\bL\\.A\\.( |,|')", "LosAngeles\\1", modRaw);
# OK/O.K. could either be "Oklahoma" or "Okay"
# modRaw <- gsub("\\bACA OK\\b", "ACA OKay", modRaw);
# modRaw <- gsub("\\bNow O\\.K\\.\\b", "Now OKay", modRaw);
# PR/P.R. could either be "PuertoRico" or "Public Relations"
# modRaw <- gsub("\\bP\\.R\\. Campaign", "PublicRelations Campaign", modRaw);
# VA/V.A. could either be "Virginia" or "VeteransAdministration"
# modRaw <- gsub("\\bthe V\\.A\\.\\:", "the VeteranAffairs:", modRaw);
#
# Custom mods
# return(mod_raw) }
# numeric
# Create feature based on record position/id in data
glbFeatsDerive[[".pos"]] <- list(
mapfn = function(raw1) { return(1:length(raw1)) }
, args = c(".rnorm"))
# glbFeatsDerive[[".pos.y"]] <- list(
# mapfn = function(raw1) { return(1:length(raw1)) }
# , args = c(".rnorm"))
# Add logs of numerics that are not distributed normally
# Derive & keep multiple transformations of the same feature, if normality is hard to achieve with just one transformation
# Right skew: logp1; sqrt; ^ 1/3; logp1(logp1); log10; exp(-<feat>/constant)
# glbFeatsDerive[["WordCount.log1p"]] <- list(
# mapfn = function(WordCount) { return(log1p(WordCount)) }
# , args = c("WordCount"))
# glbFeatsDerive[["WordCount.root2"]] <- list(
# mapfn = function(WordCount) { return(WordCount ^ (1/2)) }
# , args = c("WordCount"))
# glbFeatsDerive[["WordCount.nexp"]] <- list(
# mapfn = function(WordCount) { return(exp(-WordCount)) }
# , args = c("WordCount"))
#print(summary(glbObsAll$WordCount))
#print(summary(mapfn(glbObsAll$WordCount)))
# If imputation shd be skipped for this feature
# glbFeatsDerive[["District.fctr"]] <- list(
# mapfn = function(District) {
# raw <- District;
# ret_vals <- rep_len("NA", length(raw));
# ret_vals[!is.na(raw)] <- sapply(raw[!is.na(raw)], function(elm)
# ifelse(elm < 10, "1-9",
# ifelse(elm < 20, "10-19", "20+")));
# return(relevel(as.factor(ret_vals), ref = "NA"))
# }
# , args = c("District"))
# YOB options:
# 1. Missing data:
# 1.1 0 -> Does not improve baseline
# 1.2 Cut factors & "NA" is a level
# 2. Data corrections: < 1928 & > 2000
# 3. Scale YOB
# 4. Add Age
# YOB.Age.fctr needs to be synced with YOB.Age.dff; Create a separate sub-function ???
glbFeatsDerive[["YOB.Age.fctr"]] <- list(
mapfn = function(raw1) {
raw <- 2016 - raw1
# raw[!is.na(raw) & raw >= 2010] <- NA
raw[!is.na(raw) & (raw <= 15)] <- NA
raw[!is.na(raw) & (raw >= 90)] <- NA
retVal <- rep_len("NA", length(raw))
# breaks = c(1879, seq(1949, 1989, 10), 2049)
# cutVal <- cut(raw[!is.na(raw)], breaks = breaks,
# labels = as.character(breaks + 1)[1:(length(breaks) - 1)])
cutVal <- cut(raw[!is.na(raw)], breaks = c(15, 20, 25, 30, 35, 40, 50, 65, 90))
retVal[!is.na(raw)] <- levels(cutVal)[cutVal]
return(factor(retVal, levels = c("NA"
,"(15,20]","(20,25]","(25,30]","(30,35]","(35,40]","(40,50]","(50,65]","(65,90]"),
ordered = TRUE))
}
, args = c("YOB"))
# YOB.Age.fctr needs to be synced with YOB.Age.dff; Create a separate sub-function ???
glbFeatsDerive[["YOB.Age.dff"]] <- list(
mapfn = function(raw1) {
raw <- 2016 - raw1
raw[!is.na(raw) & (raw <= 15)] <- NA
raw[!is.na(raw) & (raw >= 90)] <- NA
breaks <- c(15, 20, 25, 30, 35, 40, 50, 65, 90)
# retVal <- rep_len(0, length(raw))
stopifnot(sum(!is.na(raw) && (raw <= 15)) == 0)
stopifnot(sum(!is.na(raw) && (raw >= 90)) == 0)
# msk <- !is.na(raw) && (raw > 15) && (raw <= 20); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 15
# msk <- !is.na(raw) && (raw > 20) && (raw <= 25); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 20
# msk <- !is.na(raw) && (raw > 25) && (raw <= 30); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 25
# msk <- !is.na(raw) && (raw > 30) && (raw <= 35); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 30
# msk <- !is.na(raw) && (raw > 35) && (raw <= 40); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 35
# msk <- !is.na(raw) && (raw > 40) && (raw <= 50); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 40
# msk <- !is.na(raw) && (raw > 50) && (raw <= 65); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 50
# msk <- !is.na(raw) && (raw > 65) && (raw <= 90); if (sum(msk > 0)) retVal[msk] <- raw[msk] - 65
breaks <- c(15, 20, 25, 30, 35, 40, 50, 65, 90)
retVal <- sapply(raw, function(age) {
if (is.na(age)) return(0) else
if ((age > 15) && (age <= 20)) return(age - 15) else
if ((age > 20) && (age <= 25)) return(age - 20) else
if ((age > 25) && (age <= 30)) return(age - 25) else
if ((age > 30) && (age <= 35)) return(age - 30) else
if ((age > 35) && (age <= 40)) return(age - 35) else
if ((age > 40) && (age <= 50)) return(age - 40) else
if ((age > 50) && (age <= 65)) return(age - 50) else
if ((age > 65) && (age <= 90)) return(age - 65)
})
return(retVal)
}
, args = c("YOB"))
glbFeatsDerive[["Gender.fctr"]] <- list(
mapfn = function(raw1) {
raw <- raw1
raw[raw %in% ""] <- "N"
raw <- gsub("Male" , "M", raw, fixed = TRUE)
raw <- gsub("Female", "F", raw, fixed = TRUE)
return(relevel(as.factor(raw), ref = "N"))
}
, args = c("Gender"))
glbFeatsDerive[["Income.fctr"]] <- list(
mapfn = function(raw1) { raw <- raw1;
raw[raw %in% ""] <- "N"
raw <- gsub("under $25,000" , "<25K" , raw, fixed = TRUE)
raw <- gsub("$25,001 - $50,000" , "25-50K" , raw, fixed = TRUE)
raw <- gsub("$50,000 - $74,999" , "50-75K" , raw, fixed = TRUE)
raw <- gsub("$75,000 - $100,000" , "75-100K" , raw, fixed = TRUE)
raw <- gsub("$100,001 - $150,000", "100-150K", raw, fixed = TRUE)
raw <- gsub("over $150,000" , ">150K" , raw, fixed = TRUE)
return(factor(raw, levels = c("N","<25K","25-50K","50-75K","75-100K","100-150K",">150K"),
ordered = TRUE))
}
, args = c("Income"))
glbFeatsDerive[["Hhold.fctr"]] <- list(
mapfn = function(raw1) { raw <- raw1;
raw[raw %in% ""] <- "N"
raw <- gsub("Domestic Partners (no kids)", "PKn", raw, fixed = TRUE)
raw <- gsub("Domestic Partners (w/kids)" , "PKy", raw, fixed = TRUE)
raw <- gsub("Married (no kids)" , "MKn", raw, fixed = TRUE)
raw <- gsub("Married (w/kids)" , "MKy", raw, fixed = TRUE)
raw <- gsub("Single (no kids)" , "SKn", raw, fixed = TRUE)
raw <- gsub("Single (w/kids)" , "SKy", raw, fixed = TRUE)
return(relevel(as.factor(raw), ref = "N"))
}
, args = c("HouseholdStatus"))
glbFeatsDerive[["Edn.fctr"]] <- list(
mapfn = function(raw1) { raw <- raw1;
raw[raw %in% ""] <- "N"
raw <- gsub("Current K-12" , "K12", raw, fixed = TRUE)
raw <- gsub("High School Diploma" , "HSD", raw, fixed = TRUE)
raw <- gsub("Current Undergraduate", "CCg", raw, fixed = TRUE)
raw <- gsub("Associate's Degree" , "Ast", raw, fixed = TRUE)
raw <- gsub("Bachelor's Degree" , "Bcr", raw, fixed = TRUE)
raw <- gsub("Master's Degree" , "Msr", raw, fixed = TRUE)
raw <- gsub("Doctoral Degree" , "PhD", raw, fixed = TRUE)
return(factor(raw, levels = c("N","K12","HSD","CCg","Ast","Bcr","Msr","PhD"),
ordered = TRUE))
}
, args = c("EducationLevel"))
# for (qsn in c("Q124742","Q124122"))
# for (qsn in grep("Q12(.{4})(?!\\.fctr)", names(glbObsTrn), value = TRUE, perl = TRUE))
for (qsn in grep("Q", glbFeatsExclude, fixed = TRUE, value = TRUE))
glbFeatsDerive[[paste0(qsn, ".fctr")]] <- list(
mapfn = function(raw1) {
raw1[raw1 %in% ""] <- "NA"
rawVal <- unique(raw1)
if (length(setdiff(rawVal, (expVal <- c("NA", "No", "Ys")))) == 0) {
raw1 <- gsub("Yes", "Ys", raw1, fixed = TRUE)
if (length(setdiff(rawVal, expVal)) > 0)
stop(qsn, " vals: ", paste0(rawVal, collapse = "|"),
" does not match expectation: ", paste0(expVal, collapse = "|"))
} else
if (length(setdiff(rawVal, (expVal <- c("NA", "Me", "Circumstances")))) == 0) {
raw1 <- gsub("Circumstances", "Cs", raw1, fixed = TRUE)
if (length(setdiff(rawVal, expVal)) > 0)
stop(qsn, " vals: ", paste0(rawVal, collapse = "|"),
" does not match expectation: ", paste0(expVal, collapse = "|"))
} else
if (length(setdiff(rawVal, (expVal <- c("NA", "Grrr people", "Yay people!")))) == 0) {
raw1 <- gsub("Grrr people", "Gr", raw1, fixed = TRUE)
raw1 <- gsub("Yay people!", "Yy", raw1, fixed = TRUE)
if (length(setdiff(rawVal, expVal)) > 0)
stop(qsn, " vals: ", paste0(rawVal, collapse = "|"),
" does not match expectation: ", paste0(expVal, collapse = "|"))
} else
if (length(setdiff(rawVal, (expVal <- c("NA", "Idealist", "Pragmatist")))) == 0) {
raw1 <- gsub("Idealist" , "Id", raw1, fixed = TRUE)
raw1 <- gsub("Pragmatist", "Pr", raw1, fixed = TRUE)
if (length(setdiff(rawVal, expVal)) > 0)
stop(qsn, " vals: ", paste0(rawVal, collapse = "|"),
" does not match expectation: ", paste0(expVal, collapse = "|"))
} else
if (length(setdiff(rawVal, (expVal <- c("NA", "Private", "Public")))) == 0) {
raw1 <- gsub("Private", "Pt", raw1, fixed = TRUE)
raw1 <- gsub("Public" , "Pc", raw1, fixed = TRUE)
if (length(setdiff(rawVal, expVal)) > 0)
stop(qsn, " vals: ", paste0(rawVal, collapse = "|"),
" does not match expectation: ", paste0(expVal, collapse = "|"))
}
return(relevel(as.factor(raw1), ref = "NA"))
}
, args = c(qsn))
# If imputation of missing data is not working ...
# glbFeatsDerive[["FertilityRate.nonNA"]] <- list(
# mapfn = function(FertilityRate, Region) {
# RegionMdn <- tapply(FertilityRate, Region, FUN = median, na.rm = TRUE)
#
# retVal <- FertilityRate
# retVal[is.na(FertilityRate)] <- RegionMdn[Region[is.na(FertilityRate)]]
# return(retVal)
# }
# , args = c("FertilityRate", "Region"))
# mapfn = function(HOSPI.COST) { return(cut(HOSPI.COST, 5, breaks = c(0, 100000, 200000, 300000, 900000), labels = NULL)) }
# mapfn = function(Rasmussen) { return(ifelse(sign(Rasmussen) >= 0, 1, 0)) }
# mapfn = function(startprice) { return(startprice ^ (1/2)) }
# mapfn = function(startprice) { return(log(startprice)) }
# mapfn = function(startprice) { return(exp(-startprice / 20)) }
# mapfn = function(startprice) { return(scale(log(startprice))) }
# mapfn = function(startprice) { return(sign(sprice.predict.diff) * (abs(sprice.predict.diff) ^ (1/10))) }
# factor
# mapfn = function(PropR) { return(as.factor(ifelse(PropR >= 0.5, "Y", "N"))) }
# mapfn = function(productline, description) { as.factor(gsub(" ", "", productline)) }
# mapfn = function(purpose) { return(relevel(as.factor(purpose), ref="all_other")) }
# mapfn = function(raw) { tfr_raw <- as.character(cut(raw, 5));
# tfr_raw[is.na(tfr_raw)] <- "NA.my";
# return(as.factor(tfr_raw)) }
# mapfn = function(startprice.log10) { return(cut(startprice.log10, 3)) }
# mapfn = function(startprice.log10) { return(cut(sprice.predict.diff, c(-1000, -100, -10, -1, 0, 1, 10, 100, 1000))) }
# , args = c("<arg1>"))
# multiple args
# mapfn = function(id, date) { return(paste(as.character(id), as.character(date), sep = "#")) }
# mapfn = function(PTS, oppPTS) { return(PTS - oppPTS) }
# mapfn = function(startprice.log10.predict, startprice) {
# return(spdiff <- (10 ^ startprice.log10.predict) - startprice) }
# mapfn = function(productline, description) { as.factor(
# paste(gsub(" ", "", productline), as.numeric(nchar(description) > 0), sep = "*")) }
# mapfn = function(.src, .pos) {
# return(paste(.src, sprintf("%04d",
# ifelse(.src == "Train", .pos, .pos - 7049)
# ), sep = "#")) }
# # If glbObsAll is not sorted in the desired manner
# mapfn=function(Week) { return(coredata(lag(zoo(orderBy(~Week, glbObsAll)$ILI), -2, na.pad=TRUE))) }
# mapfn=function(ILI) { return(coredata(lag(zoo(ILI), -2, na.pad=TRUE))) }
# mapfn=function(ILI.2.lag) { return(log(ILI.2.lag)) }
# glbFeatsDerive[["<var1>"]] <- glbFeatsDerive[["<var2>"]]
# tst <- "descr.my"; args_lst <- NULL; for (arg in glbFeatsDerive[[tst]]$args) args_lst[[arg]] <- glbObsAll[, arg]; print(head(args_lst[[arg]])); print(head(drv_vals <- do.call(glbFeatsDerive[[tst]]$mapfn, args_lst)));
# print(which_ix <- which(args_lst[[arg]] == 0.75)); print(drv_vals[which_ix]);
glbFeatsDateTime <- list()
# Use OlsonNames() to enumerate supported time zones
# glbFeatsDateTime[["<DateTimeFeat>"]] <-
# c(format = "%Y-%m-%d %H:%M:%S" or "%m/%e/%y", timezone = "US/Eastern", impute.na = TRUE,
# last.ctg = FALSE, poly.ctg = FALSE)
glbFeatsPrice <- NULL # or c("<price_var>")
glbFeatsImage <- list() #list(<imageFeat> = list(patchSize = 10)) # if patchSize not specified, no patch computation
glbFeatsText <- list()
Sys.setlocale("LC_ALL", "C") # For english
## [1] "C/C/C/C/C/en_US.UTF-8"
#glbFeatsText[["<TextFeature>"]] <- list(NULL,
# ,names = myreplacePunctuation(str_to_lower(gsub(" ", "", c(NULL,
# <comma-separated-screened-names>
# ))))
# ,rareWords = myreplacePunctuation(str_to_lower(gsub(" ", "", c(NULL,
# <comma-separated-nonSCOWL-words>
# ))))
#)
# Text Processing Step: custom modifications not present in txt_munge -> use glbFeatsDerive
# Text Processing Step: universal modifications
glb_txt_munge_filenames_pfx <- "<projectId>_mytxt_"
# Text Processing Step: tolower
# Text Processing Step: myreplacePunctuation
# Text Processing Step: removeWords
glb_txt_stop_words <- list()
# Remember to use unstemmed words
if (length(glbFeatsText) > 0) {
require(tm)
require(stringr)
glb_txt_stop_words[["<txt_var>"]] <- sort(myreplacePunctuation(str_to_lower(gsub(" ", "", c(NULL
# Remove any words from stopwords
# , setdiff(myreplacePunctuation(stopwords("english")), c("<keep_wrd1>", <keep_wrd2>"))
# Remove salutations
,"mr","mrs","dr","Rev"
# Remove misc
#,"th" # Happy [[:digit::]]+th birthday
# Remove terms present in Trn only or New only; search for "Partition post-stem"
# ,<comma-separated-terms>
# cor.y.train == NA
# ,unlist(strsplit(paste(c(NULL
# ,"<comma-separated-terms>"
# ), collapse=",")
# freq == 1; keep c("<comma-separated-terms-to-keep>")
# ,<comma-separated-terms>
# chisq.pval high (e.g. == 1); keep c("<comma-separated-terms-to-keep>")
# ,<comma-separated-terms>
# nzv.freqRatio high (e.g. >= glbFeatsNzvFreqMax); keep c("<comma-separated-terms-to-keep>")
# ,<comma-separated-terms>
)))))
}
#orderBy(~term, glb_post_stem_words_terms_df_lst[[txtFeat]][grep("^man", glb_post_stem_words_terms_df_lst[[txtFeat]]$term), ])
#glbObsAll[glb_post_stem_words_terms_mtrx_lst[[txtFeat]][, 4866] > 0, c(glb_rsp_var, txtFeat)]
# To identify terms with a specific freq
#paste0(sort(subset(glb_post_stop_words_terms_df_lst[[txtFeat]], freq == 1)$term), collapse = ",")
#paste0(sort(subset(glb_post_stem_words_terms_df_lst[[txtFeat]], freq <= 2)$term), collapse = ",")
#subset(glb_post_stem_words_terms_df_lst[[txtFeat]], term %in% c("zinger"))
# To identify terms with a specific freq &
# are not stemmed together later OR is value of color.fctr (e.g. gold)
#paste0(sort(subset(glb_post_stop_words_terms_df_lst[[txtFeat]], (freq == 1) & !(term %in% c("blacked","blemish","blocked","blocks","buying","cables","careful","carefully","changed","changing","chargers","cleanly","cleared","connect","connects","connected","contains","cosmetics","default","defaulting","defective","definitely","describe","described","devices","displays","drop","drops","engravement","excellant","excellently","feels","fix","flawlessly","frame","framing","gentle","gold","guarantee","guarantees","handled","handling","having","install","iphone","iphones","keeped","keeps","known","lights","line","lining","liquid","liquidation","looking","lots","manuals","manufacture","minis","most","mostly","network","networks","noted","opening","operated","performance","performs","person","personalized","photograph","physically","placed","places","powering","pre","previously","products","protection","purchasing","returned","rotate","rotation","running","sales","second","seconds","shipped","shuts","sides","skin","skinned","sticker","storing","thats","theres","touching","unusable","update","updates","upgrade","weeks","wrapped","verified","verify") ))$term), collapse = ",")
#print(subset(glb_post_stem_words_terms_df_lst[[txtFeat]], (freq <= 2)))
#glbObsAll[which(terms_mtrx[, 229] > 0), glbFeatsText]
# To identify terms with cor.y == NA
#orderBy(~-freq+term, subset(glb_post_stop_words_terms_df_lst[[txtFeat]], is.na(cor.y)))
#paste(sort(subset(glb_post_stop_words_terms_df_lst[[txtFeat]], is.na(cor.y))[, "term"]), collapse=",")
#orderBy(~-freq+term, subset(glb_post_stem_words_terms_df_lst[[txtFeat]], is.na(cor.y)))
# To identify terms with low cor.y.abs
#head(orderBy(~cor.y.abs+freq+term, subset(glb_post_stem_words_terms_df_lst[[txtFeat]], !is.na(cor.y))), 5)
# To identify terms with high chisq.pval
#subset(glb_post_stem_words_terms_df_lst[[txtFeat]], chisq.pval > 0.99)
#paste0(sort(subset(glb_post_stem_words_terms_df_lst[[txtFeat]], (chisq.pval > 0.99) & (freq <= 10))$term), collapse=",")
#paste0(sort(subset(glb_post_stem_words_terms_df_lst[[txtFeat]], (chisq.pval > 0.9))$term), collapse=",")
#head(orderBy(~-chisq.pval+freq+term, glb_post_stem_words_terms_df_lst[[txtFeat]]), 5)
#glbObsAll[glb_post_stem_words_terms_mtrx_lst[[txtFeat]][, 68] > 0, glbFeatsText]
#orderBy(~term, glb_post_stem_words_terms_df_lst[[txtFeat]][grep("^m", glb_post_stem_words_terms_df_lst[[txtFeat]]$term), ])
# To identify terms with high nzv.freqRatio
#summary(glb_post_stem_words_terms_df_lst[[txtFeat]]$nzv.freqRatio)
#paste0(sort(setdiff(subset(glb_post_stem_words_terms_df_lst[[txtFeat]], (nzv.freqRatio >= glbFeatsNzvFreqMax) & (freq < 10) & (chisq.pval >= 0.05))$term, c( "128gb","3g","4g","gold","ipad1","ipad3","ipad4","ipadair2","ipadmini2","manufactur","spacegray","sprint","tmobil","verizon","wifion"))), collapse=",")
# To identify obs with a txt term
#tail(orderBy(~-freq+term, glb_post_stop_words_terms_df_lst[[txtFeat]]), 20)
#mydspObs(list(descr.my.contains="non"), cols=c("color", "carrier", "cellular", "storage"))
#grep("ever", dimnames(terms_stop_mtrx)$Terms)
#which(terms_stop_mtrx[, grep("ipad", dimnames(terms_stop_mtrx)$Terms)] > 0)
#glbObsAll[which(terms_stop_mtrx[, grep("16", dimnames(terms_stop_mtrx)$Terms)[1]] > 0), c(glbFeatsCategory, "storage", txtFeat)]
# Text Processing Step: screen for names # Move to glbFeatsText specs section in order of text processing steps
# glbFeatsText[["<txtFeat>"]]$names <- myreplacePunctuation(str_to_lower(gsub(" ", "", c(NULL
# # Person names for names screening
# ,<comma-separated-list>
#
# # Company names
# ,<comma-separated-list>
#
# # Product names
# ,<comma-separated-list>
# ))))
# glbFeatsText[["<txtFeat>"]]$rareWords <- myreplacePunctuation(str_to_lower(gsub(" ", "", c(NULL
# # Words not in SCOWL db
# ,<comma-separated-list>
# ))))
# To identify char vectors post glbFeatsTextMap
#grep("six(.*)hour", glb_txt_chr_lst[[txtFeat]], ignore.case = TRUE, value = TRUE)
#grep("[S|s]ix(.*)[H|h]our", glb_txt_chr_lst[[txtFeat]], value = TRUE)
# To identify whether terms shd be synonyms
#orderBy(~term, glb_post_stop_words_terms_df_lst[[txtFeat]][grep("^moder", glb_post_stop_words_terms_df_lst[[txtFeat]]$term), ])
# term_row_df <- glb_post_stop_words_terms_df_lst[[txtFeat]][grep("^came$", glb_post_stop_words_terms_df_lst[[txtFeat]]$term), ]
#
# cor(glb_post_stop_words_terms_mtrx_lst[[txtFeat]][glbObsAll$.lcn == "Fit", term_row_df$pos], glbObsTrn[, glb_rsp_var], use="pairwise.complete.obs")
# To identify which stopped words are "close" to a txt term
#sort(glbFeatsCluster)
# Text Processing Step: stemDocument
# To identify stemmed txt terms
#glb_post_stop_words_terms_df_lst[[txtFeat]][grep("^la$", glb_post_stop_words_terms_df_lst[[txtFeat]]$term), ]
#orderBy(~term, glb_post_stem_words_terms_df_lst[[txtFeat]][grep("^con", glb_post_stem_words_terms_df_lst[[txtFeat]]$term), ])
#glbObsAll[which(terms_stem_mtrx[, grep("use", dimnames(terms_stem_mtrx)$Terms)[[1]]] > 0), c(glbFeatsId, "productline", txtFeat)]
#glbObsAll[which(TfIdf_stem_mtrx[, 191] > 0), c(glbFeatsId, glbFeatsCategory, txtFeat)]
#glbObsAll[which(glb_post_stop_words_terms_mtrx_lst[[txtFeat]][, 6165] > 0), c(glbFeatsId, glbFeatsCategory, txtFeat)]
#which(glbObsAll$UniqueID %in% c(11915, 11926, 12198))
# Text Processing Step: mycombineSynonyms
# To identify which terms are associated with not -> combine "could not" & "couldn't"
#findAssocs(glb_full_DTM_lst[[txtFeat]], "not", 0.05)
# To identify which synonyms should be combined
#orderBy(~term, glb_post_stem_words_terms_df_lst[[txtFeat]][grep("^c", glb_post_stem_words_terms_df_lst[[txtFeat]]$term), ])
chk_comb_cor <- function(syn_lst) {
# cor(terms_stem_mtrx[glbObsAll$.src == "Train", grep("^(damag|dent|ding)$", dimnames(terms_stem_mtrx)[[2]])], glbObsTrn[, glb_rsp_var], use="pairwise.complete.obs")
print(subset(glb_post_stem_words_terms_df_lst[[txtFeat]], term %in% syn_lst$syns))
print(subset(get_corpus_terms(tm_map(glbFeatsTextCorpus[[txtFeat]], mycombineSynonyms, list(syn_lst), lazy=FALSE)), term == syn_lst$word))
# cor(terms_stop_mtrx[glbObsAll$.src == "Train", grep("^(damage|dent|ding)$", dimnames(terms_stop_mtrx)[[2]])], glbObsTrn[, glb_rsp_var], use="pairwise.complete.obs")
# cor(rowSums(terms_stop_mtrx[glbObsAll$.src == "Train", grep("^(damage|dent|ding)$", dimnames(terms_stop_mtrx)[[2]])]), glbObsTrn[, glb_rsp_var], use="pairwise.complete.obs")
}
#chk_comb_cor(syn_lst=list(word="cabl", syns=c("cabl", "cord")))
#chk_comb_cor(syn_lst=list(word="damag", syns=c("damag", "dent", "ding")))
#chk_comb_cor(syn_lst=list(word="dent", syns=c("dent", "ding")))
#chk_comb_cor(syn_lst=list(word="use", syns=c("use", "usag")))
glbFeatsTextSynonyms <- list()
# list parsed to collect glbFeatsText[[<txtFeat>]]$vldTerms
# glbFeatsTextSynonyms[["Hdln.my"]] <- list(NULL
# # people in places
# , list(word = "australia", syns = c("australia", "australian"))
# , list(word = "italy", syns = c("italy", "Italian"))
# , list(word = "newyork", syns = c("newyork", "newyorker"))
# , list(word = "Pakistan", syns = c("Pakistan", "Pakistani"))
# , list(word = "peru", syns = c("peru", "peruvian"))
# , list(word = "qatar", syns = c("qatar", "qatari"))
# , list(word = "scotland", syns = c("scotland", "scotish"))
# , list(word = "Shanghai", syns = c("Shanghai", "Shanzhai"))
# , list(word = "venezuela", syns = c("venezuela", "venezuelan"))
#
# # companies - needs to be data dependent
# # - e.g. ensure BNP in this experiment/feat always refers to BNPParibas
#
# # general synonyms
# , list(word = "Create", syns = c("Create","Creator"))
# , list(word = "cute", syns = c("cute","cutest"))
# , list(word = "Disappear", syns = c("Disappear","Fadeout"))
# , list(word = "teach", syns = c("teach", "taught"))
# , list(word = "theater", syns = c("theater", "theatre", "theatres"))
# , list(word = "understand", syns = c("understand", "understood"))
# , list(word = "weak", syns = c("weak", "weaken", "weaker", "weakest"))
# , list(word = "wealth", syns = c("wealth", "wealthi"))
#
# # custom synonyms (phrases)
#
# # custom synonyms (names)
# )
#glbFeatsTextSynonyms[["<txtFeat>"]] <- list(NULL
# , list(word="<stem1>", syns=c("<stem1>", "<stem1_2>"))
# )
for (txtFeat in names(glbFeatsTextSynonyms))
for (entryIx in 1:length(glbFeatsTextSynonyms[[txtFeat]])) {
glbFeatsTextSynonyms[[txtFeat]][[entryIx]]$word <-
str_to_lower(glbFeatsTextSynonyms[[txtFeat]][[entryIx]]$word)
glbFeatsTextSynonyms[[txtFeat]][[entryIx]]$syns <-
str_to_lower(glbFeatsTextSynonyms[[txtFeat]][[entryIx]]$syns)
}
glbFeatsTextSeed <- 181
# tm options include: check tm::weightSMART
glb_txt_terms_control <- list( # Gather model performance & run-time stats
# weighting = function(x) weightSMART(x, spec = "nnn")
# weighting = function(x) weightSMART(x, spec = "lnn")
# weighting = function(x) weightSMART(x, spec = "ann")
# weighting = function(x) weightSMART(x, spec = "bnn")
# weighting = function(x) weightSMART(x, spec = "Lnn")
#
weighting = function(x) weightSMART(x, spec = "ltn") # default
# weighting = function(x) weightSMART(x, spec = "lpn")
#
# weighting = function(x) weightSMART(x, spec = "ltc")
#
# weighting = weightBin
# weighting = weightTf
# weighting = weightTfIdf # : default
# termFreq selection criteria across obs: tm default: list(global=c(1, Inf))
, bounds = list(global = c(1, Inf))
# wordLengths selection criteria: tm default: c(3, Inf)
, wordLengths = c(1, Inf)
)
glb_txt_cor_var <- glb_rsp_var # : default # or c(<feat>)
# select one from c("union.top.val.cor", "top.cor", "top.val", default: "top.chisq", "sparse")
glbFeatsTextFilter <- "top.chisq"
glbFeatsTextTermsMax <- rep(10, length(glbFeatsText)) # :default
names(glbFeatsTextTermsMax) <- names(glbFeatsText)
# Text Processing Step: extractAssoc
glbFeatsTextAssocCor <- rep(1, length(glbFeatsText)) # :default
names(glbFeatsTextAssocCor) <- names(glbFeatsText)
# Remember to use stemmed terms
glb_important_terms <- list()
# Text Processing Step: extractPatterns (ngrams)
glbFeatsTextPatterns <- list()
#glbFeatsTextPatterns[[<txtFeat>>]] <- list()
#glbFeatsTextPatterns[[<txtFeat>>]] <- c(metropolitan.diary.colon = "Metropolitan Diary:")
# Have to set it even if it is not used
# Properties:
# numrows(glb_feats_df) << numrows(glbObsFit
# Select terms that appear in at least 0.2 * O(FP/FN(glbObsOOB)) ???
# numrows(glbObsOOB) = 1.1 * numrows(glbObsNew) ???
glb_sprs_thresholds <- NULL # or c(<txtFeat1> = 0.988, <txtFeat2> = 0.970, <txtFeat3> = 0.970)
glbFctrMaxUniqVals <- 20 # default: 20
glb_impute_na_data <- FALSE # or TRUE
glb_mice_complete.seed <- 144 # or any integer
glbFeatsCluster <- paste(grep("^Q.", glbFeatsExclude, value = TRUE), "fctr", sep = ".") # NULL : glbFeatsCluster <- c("YOB.Age.fctr", "Gender.fctr", "Income.fctr",
# # "Hhold.fctr",
# "Edn.fctr",
# paste(grep("^Q.", glbFeatsExclude, value = TRUE), "fctr", sep = ".")) # NULL : default or c("<feat1>", "<feat2>")
# glbFeatsCluster <- grep(paste0("[",
# toupper(paste0(substr(glbFeatsText, 1, 1), collapse = "")),
# "]\\.[PT]\\."),
# names(glbObsAll), value = TRUE)
glb_cluster.seed <- 189 # or any integer
glbClusterEntropyVar <- NULL # c(glb_rsp_var, as.factor(cut(glb_rsp_var, 3)), default: NULL)
glbFeatsClusterVarsExclude <- FALSE # default FALSE
glb_interaction_only_feats <- NULL # : default or c(<parent_feat> = "<child_feat>")
glbFeatsNzvFreqMax <- 19 # 19 : caret default
glbFeatsNzvUniqMin <- 10 # 10 : caret default
glbRFESizes <- list()
#glbRFESizes[["mdlFamily"]] <- c(4, 8, 16, 32, 64, 67, 68, 69) # Accuracy@69/70 = 0.8258
glbObsFitOutliers <- list()
# If outliers.n >= 10; consider concatenation of interaction vars
# glbObsFitOutliers[["<mdlFamily>"]] <- c(NULL
# is.na(.rstudent)
# max(.rstudent)
# is.na(.dffits)
# .hatvalues >= 0.99
# -38,167,642 < minmax(.rstudent) < 49,649,823
# , <comma-separated-<glbFeatsId>>
# )
glbObsTrnOutliers <- list()
glbObsTrnOutliers[["Final"]] <- union(glbObsFitOutliers[["All.X"]],
c(NULL
))
# influence.measures: car::outlier; rstudent; dffits; hatvalues; dfbeta; dfbetas
#mdlId <- "All.X##rcv#glm"; obs_df <- fitobs_df
#mdlId <- "RFE.X.glm"; obs_df <- fitobs_df
#mdlId <- "Final.glm"; obs_df <- trnobs_df
#mdlId <- "CSM2.X.glm"; obs_df <- fitobs_df
#print(outliers <- car::outlierTest(glb_models_lst[[mdlId]]$finalModel))
#mdlIdFamily <- paste0(head(unlist(str_split(mdlId, "\\.")), -1), collapse="."); obs_df <- dplyr::filter_(obs_df, interp(~(!(var %in% glbObsFitOutliers[[mdlIdFamily]])), var = as.name(glbFeatsId))); model_diags_df <- cbind(obs_df, data.frame(.rstudent=stats::rstudent(glb_models_lst[[mdlId]]$finalModel)), data.frame(.dffits=stats::dffits(glb_models_lst[[mdlId]]$finalModel)), data.frame(.hatvalues=stats::hatvalues(glb_models_lst[[mdlId]]$finalModel)));print(summary(model_diags_df[, c(".rstudent",".dffits",".hatvalues")])); table(cut(model_diags_df$.hatvalues, breaks=c(0.00, 0.98, 0.99, 1.00)))
#print(subset(model_diags_df, is.na(.rstudent))[, glbFeatsId])
#print(model_diags_df[which.max(model_diags_df$.rstudent), ])
#print(subset(model_diags_df, is.na(.dffits))[, glbFeatsId])
#print(model_diags_df[which.min(model_diags_df$.dffits), ])
#print(subset(model_diags_df, .hatvalues > 0.99)[, glbFeatsId])
#dffits_df <- merge(dffits_df, outliers_df, by="row.names", all.x=TRUE); row.names(dffits_df) <- dffits_df$Row.names; dffits_df <- subset(dffits_df, select=-Row.names)
#dffits_df <- merge(dffits_df, glbObsFit, by="row.names", all.x=TRUE); row.names(dffits_df) <- dffits_df$Row.names; dffits_df <- subset(dffits_df, select=-Row.names)
#subset(dffits_df, !is.na(.Bonf.p))
#mdlId <- "CSM.X.glm"; vars <- myextract_actual_feats(row.names(orderBy(reformulate(c("-", paste0(mdlId, ".imp"))), myget_feats_imp(glb_models_lst[[mdlId]]))));
#model_diags_df <- glb_get_predictions(model_diags_df, mdlId, glb_rsp_var)
#obs_ix <- row.names(model_diags_df) %in% names(outliers$rstudent)[1]
#obs_ix <- which(is.na(model_diags_df$.rstudent))
#obs_ix <- which(is.na(model_diags_df$.dffits))
#myplot_parcoord(obs_df=model_diags_df[, c(glbFeatsId, glbFeatsCategory, ".rstudent", ".dffits", ".hatvalues", glb_rsp_var, paste0(glb_rsp_var, mdlId), vars[1:min(20, length(vars))])], obs_ix=obs_ix, id_var=glbFeatsId, category_var=glbFeatsCategory)
#model_diags_df[row.names(model_diags_df) %in% names(outliers$rstudent)[c(1:2)], ]
#ctgry_diags_df <- model_diags_df[model_diags_df[, glbFeatsCategory] %in% c("Unknown#0"), ]
#myplot_parcoord(obs_df=ctgry_diags_df[, c(glbFeatsId, glbFeatsCategory, ".rstudent", ".dffits", ".hatvalues", glb_rsp_var, "startprice.log10.predict.RFE.X.glmnet", indepVar[1:20])], obs_ix=row.names(ctgry_diags_df) %in% names(outliers$rstudent)[1], id_var=glbFeatsId, category_var=glbFeatsCategory)
#table(glbObsFit[model_diags_df[, glbFeatsCategory] %in% c("iPad1#1"), "startprice.log10.cut.fctr"])
#glbObsFit[model_diags_df[, glbFeatsCategory] %in% c("iPad1#1"), c(glbFeatsId, "startprice")]
# No outliers & .dffits == NaN
#myplot_parcoord(obs_df=model_diags_df[, c(glbFeatsId, glbFeatsCategory, glb_rsp_var, "startprice.log10.predict.RFE.X.glmnet", indepVar[1:10])], obs_ix=seq(1:nrow(model_diags_df))[is.na(model_diags_df$.dffits)], id_var=glbFeatsId, category_var=glbFeatsCategory)
# Modify mdlId to (build & extract) "<FamilyId>#<Fit|Trn>#<caretMethod>#<preProc1.preProc2>#<samplingMethod>"
glb_models_lst <- list(); glb_models_df <- data.frame()
# Add xgboost algorithm
# Regression
if (glb_is_regression) {
glbMdlMethods <- c(NULL
# deterministic
#, "lm", # same as glm
, "glm", "bayesglm", "glmnet"
, "rpart"
# non-deterministic
, "gbm", "rf"
# Unknown
, "nnet" , "avNNet" # runs 25 models per cv sample for tunelength=5
, "svmLinear", "svmLinear2"
, "svmPoly" # runs 75 models per cv sample for tunelength=5
, "svmRadial"
, "earth"
, "bagEarth" # Takes a long time
,"xgbLinear","xgbTree"
)
} else
# Classification - Add ada (auto feature selection)
if (glb_is_binomial)
glbMdlMethods <- c(NULL
# deterministic
, "bagEarth" # Takes a long time
, "glm", "bayesglm", "glmnet"
, "nnet"
, "rpart"
# non-deterministic
, "gbm"
, "avNNet" # runs 25 models per cv sample for tunelength=5
, "rf"
# Unknown
, "lda", "lda2"
# svm models crash when predict is called -> internal to kernlab it should call predict without .outcome
, "svmLinear", "svmLinear2"
, "svmPoly" # runs 75 models per cv sample for tunelength=5
, "svmRadial"
, "earth"
,"xgbLinear","xgbTree"
) else
glbMdlMethods <- c(NULL
# deterministic
,"glmnet"
# non-deterministic
,"rf"
# Unknown
,"gbm","rpart","xgbLinear","xgbTree"
)
glbMdlFamilies <- list(); glb_mdl_feats_lst <- list()
# family: Choose from c("RFE.X", "CSM.X", "All.X", "Best.Interact")
# methods: Choose from c(NULL, <method>, glbMdlMethods)
#glbMdlFamilies[["RFE.X"]] <- c("glmnet", "glm") # non-NULL vector is mandatory
if (glb_is_classification && !glb_is_binomial)
# glm does not work for multinomial
glbMdlFamilies[["All.X"]] <- c("glmnet") else
glbMdlFamilies[["All.X"]] <- c("glmnet", "glm")
#glbMdlFamilies[["Best.Interact"]] <- "glmnet" # non-NULL vector is mandatory
# Check if interaction features make RFE better
# glbMdlFamilies[["CSM.X"]] <- setdiff(glbMdlMethods, c("lda", "lda2")) # crashing due to category:.clusterid ??? #c("glmnet", "glm") # non-NULL list is mandatory
# glb_mdl_feats_lst[["CSM.X"]] <- c(NULL
# , <comma-separated-features-vector>
# )
# dAFeats.CSM.X %<d-% c(NULL
# # Interaction feats up to varImp(RFE.X.glmnet) >= 50
# , <comma-separated-features-vector>
# , setdiff(myextract_actual_feats(predictors(rfe_fit_results)), c(NULL
# , <comma-separated-features-vector>
# ))
# )
# glb_mdl_feats_lst[["CSM.X"]] <- "%<d-% dAFeats.CSM.X"
glbMdlFamilies[["Final"]] <- c(NULL) # NULL vector acceptable # c("glmnet", "glm")
glbMdlAllowParallel <- list()
#glbMdlAllowParallel[["Final##rcv#glmnet"]] <- FALSE
glbMdlAllowParallel[["All.X##rcv#glm"]] <- FALSE
# Check if tuning parameters make fit better; make it mdlFamily customizable ?
glbMdlTuneParams <- data.frame()
# When glmnet crashes at model$grid with error: ???
glmnetTuneParams <- rbind(data.frame()
,data.frame(parameter = "alpha", vals = "0.100 0.325 0.550 0.775 1.000")
,data.frame(parameter = "lambda", vals = "9.342e-02")
)
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams,
# cbind(data.frame(mdlId = "<mdlId>"),
# glmnetTuneParams))
#avNNet
# size=[1] 3 5 7 9; decay=[0] 1e-04 0.001 0.01 0.1; bag=[FALSE]; RMSE=1.3300906
#bagEarth
# degree=1 [2] 3; nprune=64 128 256 512 [1024]; RMSE=0.6486663 (up)
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
# ,data.frame(method = "bagEarth", parameter = "nprune", vals = "256")
# ,data.frame(method = "bagEarth", parameter = "degree", vals = "2")
# ))
#earth
# degree=[1]; nprune=2 [9] 17 25 33; RMSE=0.1334478
#gbm
# shrinkage=0.05 [0.10] 0.15 0.20 0.25; n.trees=100 150 200 [250] 300; interaction.depth=[1] 2 3 4 5; n.minobsinnode=[10]; RMSE=0.2008313
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
# ,data.frame(method = "gbm", parameter = "shrinkage", min = 0.05, max = 0.25, by = 0.05)
# ,data.frame(method = "gbm", parameter = "n.trees", min = 100, max = 300, by = 50)
# ,data.frame(method = "gbm", parameter = "interaction.depth", min = 1, max = 5, by = 1)
# ,data.frame(method = "gbm", parameter = "n.minobsinnode", min = 10, max = 10, by = 10)
# #seq(from=0.05, to=0.25, by=0.05)
# ))
#glmnet
# alpha=0.100 [0.325] 0.550 0.775 1.000; lambda=0.0005232693 0.0024288010 0.0112734954 [0.0523269304] 0.2428800957; RMSE=0.6164891
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
# ,data.frame(method = "glmnet", parameter = "alpha", vals = "0.550 0.775 0.8875 0.94375 1.000")
# ,data.frame(method = "glmnet", parameter = "lambda", vals = "9.858855e-05 0.0001971771 0.0009152152 0.0042480525 0.0197177130")
# ))
#nnet
# size=3 5 [7] 9 11; decay=0.0001 0.001 0.01 [0.1] 0.2; RMSE=0.9287422
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
# ,data.frame(method = "nnet", parameter = "size", vals = "3 5 7 9 11")
# ,data.frame(method = "nnet", parameter = "decay", vals = "0.0001 0.0010 0.0100 0.1000 0.2000")
# ))
#rf # Don't bother; results are not deterministic
# mtry=2 35 68 [101] 134; RMSE=0.1339974
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
# ,data.frame(method = "rf", parameter = "mtry", vals = "2 5 9 13 17")
# ))
#rpart
# cp=0.020 [0.025] 0.030 0.035 0.040; RMSE=0.1770237
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
# ,data.frame(method = "rpart", parameter = "cp", vals = "0.004347826 0.008695652 0.017391304 0.021739130 0.034782609")
# ))
#svmLinear
# C=0.01 0.05 [0.10] 0.50 1.00 2.00 3.00 4.00; RMSE=0.1271318; 0.1296718
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
# ,data.frame(method = "svmLinear", parameter = "C", vals = "0.01 0.05 0.1 0.5 1")
# ))
#svmLinear2
# cost=0.0625 0.1250 [0.25] 0.50 1.00; RMSE=0.1276354
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
# ,data.frame(method = "svmLinear2", parameter = "cost", vals = "0.0625 0.125 0.25 0.5 1")
# ))
#svmPoly
# degree=[1] 2 3 4 5; scale=0.01 0.05 [0.1] 0.5 1; C=0.50 1.00 [2.00] 3.00 4.00; RMSE=0.1276130
# glbMdlTuneParams <- myrbind_df(glbMdlTuneParams, rbind(data.frame()
# ,data.frame(method="svmPoly", parameter="degree", min=1, max=5, by=1) #seq(1, 5, 1)
# ,data.frame(method="svmPoly", parameter="scale", vals="0.01, 0.05, 0.1, 0.5, 1")
# ,data.frame(method="svmPoly", parameter="C", vals="0.50, 1.00, 2.00, 3.00, 4.00")
# ))
#svmRadial
# sigma=[0.08674323]; C=0.25 0.50 1.00 [2.00] 4.00; RMSE=0.1614957
#glb2Sav(); all.equal(sav_models_df, glb_models_df)
glb_preproc_methods <- NULL
# c("YeoJohnson", "center.scale", "range", "pca", "ica", "spatialSign")
# Baseline prediction model feature(s)
glb_Baseline_mdl_var <- NULL # or c("<feat>")
glbMdlMetric_terms <- NULL # or matrix(c(
# 0,1,2,3,4,
# 2,0,1,2,3,
# 4,2,0,1,2,
# 6,4,2,0,1,
# 8,6,4,2,0
# ), byrow=TRUE, nrow=5)
glbMdlMetricSummary <- NULL # or "<metric_name>"
glbMdlMetricMaximize <- NULL # or FALSE (TRUE is not the default for both classification & regression)
glbMdlMetricSummaryFn <- NULL # or function(data, lev=NULL, model=NULL) {
# confusion_mtrx <- t(as.matrix(confusionMatrix(data$pred, data$obs)))
# #print(confusion_mtrx)
# #print(confusion_mtrx * glbMdlMetric_terms)
# metric <- sum(confusion_mtrx * glbMdlMetric_terms) / nrow(data)
# names(metric) <- glbMdlMetricSummary
# return(metric)
# }
glbMdlCheckRcv <- FALSE # Turn it on when needed; otherwise takes long time
glb_rcv_n_folds <- 3 # or NULL
glb_rcv_n_repeats <- 3 # or NULL
glb_clf_proba_threshold <- NULL # 0.5
# Model selection criteria
if (glb_is_regression)
glbMdlMetricsEval <- c("min.RMSE.OOB", "max.R.sq.OOB", "max.Adj.R.sq.fit", "min.RMSE.fit")
#glbMdlMetricsEval <- c("min.RMSE.fit", "max.R.sq.fit", "max.Adj.R.sq.fit")
if (glb_is_classification) {
if (glb_is_binomial)
glbMdlMetricsEval <-
c("max.Accuracy.OOB", "max.AUCROCR.OOB", "max.AUCpROC.OOB", "min.aic.fit", "max.Accuracy.fit") else
glbMdlMetricsEval <- c("max.Accuracy.OOB", "max.Kappa.OOB")
}
# select from NULL [no ensemble models], "auto" [all models better than MFO or Baseline], c(mdl_ids in glb_models_lst) [Typically top-rated models in auto]
glb_mdl_ensemble <- NULL
# "%<d-% setdiff(mygetEnsembleAutoMdlIds(), 'CSM.X.rf')"
# c(<comma-separated-mdlIds>
# )
# Only for classifications; for regressions remove "(.*)\\.prob" form the regex
# tmp_fitobs_df <- glbObsFit[, grep(paste0("^", gsub(".", "\\.", mygetPredictIds$value, fixed = TRUE), "CSM\\.X\\.(.*)\\.prob"), names(glbObsFit), value = TRUE)]; cor_mtrx <- cor(tmp_fitobs_df); cor_vctr <- sort(cor_mtrx[row.names(orderBy(~-Overall, varImp(glb_models_lst[["Ensemble.repeatedcv.glmnet"]])$imp))[1], ]); summary(cor_vctr); cor_vctr
#ntv.glm <- glm(reformulate(indepVar, glb_rsp_var), family = "binomial", data = glbObsFit)
#step.glm <- step(ntv.glm)
glbMdlSelId <- "All.X##rcv#glmnet" #select from c(NULL, "All.X##rcv#glmnet", "RFE.X##rcv#glmnet", <mdlId>)
glbMdlFinId <- NULL #select from c(NULL, glbMdlSelId)
glb_dsp_cols <- c(".pos", glbFeatsId, glbFeatsCategory, glb_rsp_var
# List critical cols excl. above
)
# Output specs
# lclgetfltout_df <- function(obsOutFinDf) {
# require(tidyr)
# obsOutFinDf <- obsOutFinDf %>%
# tidyr::separate("ImageId.x.y", c(".src", ".pos", "x", "y"),
# sep = "#", remove = TRUE, extra = "merge")
# # mnm prefix stands for max_n_mean
# mnmout_df <- obsOutFinDf %>%
# dplyr::group_by(.pos) %>%
# #dplyr::top_n(1, Probability1) %>% # Score = 3.9426
# #dplyr::top_n(2, Probability1) %>% # Score = ???; weighted = 3.94254;
# #dplyr::top_n(3, Probability1) %>% # Score = 3.9418; weighted = 3.94169;
# dplyr::top_n(4, Probability1) %>% # Score = ???; weighted = 3.94149;
# #dplyr::top_n(5, Probability1) %>% # Score = 3.9421; weighted = 3.94178
#
# # dplyr::summarize(xMeanN = mean(as.numeric(x)), yMeanN = mean(as.numeric(y)))
# # dplyr::summarize(xMeanN = weighted.mean(as.numeric(x), Probability1), yMeanN = mean(as.numeric(y)))
# # dplyr::summarize(xMeanN = weighted.mean(as.numeric(x), c(Probability1, 0.2357323, 0.2336925)), yMeanN = mean(as.numeric(y)))
# # dplyr::summarize(xMeanN = weighted.mean(as.numeric(x), c(Probability1)), yMeanN = mean(as.numeric(y)))
# dplyr::summarize(xMeanN = weighted.mean(as.numeric(x), c(Probability1)),
# yMeanN = weighted.mean(as.numeric(y), c(Probability1)))
#
# maxout_df <- obsOutFinDf %>%
# dplyr::group_by(.pos) %>%
# dplyr::summarize(maxProb1 = max(Probability1))
# fltout_df <- merge(maxout_df, obsOutFinDf,
# by.x = c(".pos", "maxProb1"), by.y = c(".pos", "Probability1"),
# all.x = TRUE)
# fmnout_df <- merge(fltout_df, mnmout_df,
# by.x = c(".pos"), by.y = c(".pos"),
# all.x = TRUE)
# return(fmnout_df)
# }
glbObsOut <- list(NULL
# glbFeatsId will be the first output column, by default
,vars = list()
# ,mapFn = function(obsOutFinDf) {
# }
)
#obsOutFinDf <- savobsOutFinDf
# glbObsOut$mapFn <- function(obsOutFinDf) {
# txfout_df <- dplyr::select(obsOutFinDf, -.pos.y) %>%
# dplyr::mutate(
# lunch = levels(glbObsTrn[, "lunch" ])[
# round(mean(as.numeric(glbObsTrn[, "lunch" ])), 0)],
# dinner = levels(glbObsTrn[, "dinner" ])[
# round(mean(as.numeric(glbObsTrn[, "dinner" ])), 0)],
# reserve = levels(glbObsTrn[, "reserve" ])[
# round(mean(as.numeric(glbObsTrn[, "reserve" ])), 0)],
# outdoor = levels(glbObsTrn[, "outdoor" ])[
# round(mean(as.numeric(glbObsTrn[, "outdoor" ])), 0)],
# expensive = levels(glbObsTrn[, "expensive"])[
# round(mean(as.numeric(glbObsTrn[, "expensive"])), 0)],
# liquor = levels(glbObsTrn[, "liquor" ])[
# round(mean(as.numeric(glbObsTrn[, "liquor" ])), 0)],
# table = levels(glbObsTrn[, "table" ])[
# round(mean(as.numeric(glbObsTrn[, "table" ])), 0)],
# classy = levels(glbObsTrn[, "classy" ])[
# round(mean(as.numeric(glbObsTrn[, "classy" ])), 0)],
# kids = levels(glbObsTrn[, "kids" ])[
# round(mean(as.numeric(glbObsTrn[, "kids" ])), 0)]
# )
#
# print("ObsNew output class tables:")
# print(sapply(c("lunch","dinner","reserve","outdoor",
# "expensive","liquor","table",
# "classy","kids"),
# function(feat) table(txfout_df[, feat], useNA = "ifany")))
#
# txfout_df <- txfout_df %>%
# dplyr::mutate(labels = "") %>%
# dplyr::mutate(labels =
# ifelse(lunch != "-1", paste(labels, lunch ), labels)) %>%
# dplyr::mutate(labels =
# ifelse(dinner != "-1", paste(labels, dinner ), labels)) %>%
# dplyr::mutate(labels =
# ifelse(reserve != "-1", paste(labels, reserve ), labels)) %>%
# dplyr::mutate(labels =
# ifelse(outdoor != "-1", paste(labels, outdoor ), labels)) %>%
# dplyr::mutate(labels =
# ifelse(expensive != "-1", paste(labels, expensive), labels)) %>%
# dplyr::mutate(labels =
# ifelse(liquor != "-1", paste(labels, liquor ), labels)) %>%
# dplyr::mutate(labels =
# ifelse(table != "-1", paste(labels, table ), labels)) %>%
# dplyr::mutate(labels =
# ifelse(classy != "-1", paste(labels, classy ), labels)) %>%
# dplyr::mutate(labels =
# ifelse(kids != "-1", paste(labels, kids ), labels)) %>%
# dplyr::select(business_id, labels)
# return(txfout_df)
# }
#if (!is.null(glbObsOut$mapFn)) obsOutFinDf <- glbObsOut$mapFn(obsOutFinDf); print(head(obsOutFinDf))
glb_out_obs <- NULL # select from c(NULL : default to "new", "all", "new", "trn")
if (glb_is_classification && glb_is_binomial) {
# glbObsOut$vars[["Probability1"]] <-
# "%<d-% glbObsNew[, mygetPredictIds(glb_rsp_var, glbMdlFinId)$prob]"
# glbObsOut$vars[[glb_rsp_var_raw]] <-
# "%<d-% glb_map_rsp_var_to_raw(glbObsNew[,
# mygetPredictIds(glb_rsp_var, glbMdlFinId)$value])"
glbObsOut$vars[["Predictions"]] <-
"%<d-% glb_map_rsp_var_to_raw(glbObsNew[,
mygetPredictIds(glb_rsp_var, glbMdlFinId)$value])"
} else {
# glbObsOut$vars[[glbFeatsId]] <-
# "%<d-% as.integer(gsub('Test#', '', glbObsNew[, glbFeatsId]))"
glbObsOut$vars[[glb_rsp_var]] <-
"%<d-% glbObsNew[, mygetPredictIds(glb_rsp_var, glbMdlFinId)$value]"
# for (outVar in setdiff(glbFeatsExcludeLcl, glb_rsp_var_raw))
# glbObsOut$vars[[outVar]] <-
# paste0("%<d-% mean(glbObsAll[, \"", outVar, "\"], na.rm = TRUE)")
}
# glbObsOut$vars[[glb_rsp_var_raw]] <- glb_rsp_var_raw
# glbObsOut$vars[[paste0(head(unlist(strsplit(mygetPredictIds$value, "")), -1), collapse = "")]] <-
glbOutStackFnames <- NULL #: default
# c("ebayipads_txt_assoc1_out_bid1_stack.csv") # manual stack
# c("ebayipads_finmdl_bid1_out_nnet_1.csv") # universal stack
glbOut <- list(pfx = "Votes_Age_Q109244_")
# lclImageSampleSeed <- 129
glbOutDataVizFname <- NULL # choose from c(NULL, "<projectId>_obsall.csv")
glbChunks <- list(labels = c("set_global_options_wd","set_global_options"
,"import.data","inspect.data","scrub.data","transform.data"
,"extract.features"
,"extract.features.datetime","extract.features.image","extract.features.price"
,"extract.features.text","extract.features.string"
,"extract.features.end"
,"manage.missing.data","cluster.data","partition.data.training","select.features"
,"fit.models_0","fit.models_1","fit.models_2","fit.models_3"
,"fit.data.training_0","fit.data.training_1"
,"predict.data.new"
,"display.session.info"))
# To ensure that all chunks in this script are in glbChunks
if (!is.null(chkChunksLabels <- knitr::all_labels()) && # knitr::all_labels() doesn't work in console runs
!identical(chkChunksLabels, glbChunks$labels)) {
print(sprintf("setdiff(chkChunksLabels, glbChunks$labels): %s",
setdiff(chkChunksLabels, glbChunks$labels)))
print(sprintf("setdiff(glbChunks$labels, chkChunksLabels): %s",
setdiff(glbChunks$labels, chkChunksLabels)))
}
glbChunks[["first"]] <- NULL #default: script will load envir from previous chunk
glbChunks[["last" ]] <- NULL #default: script will save envir at end of this chunk
glbChunks[["inpFilePathName"]] <- NULL # "data/<prvScriptName>_<lstChunkLbl>.RData"
#mysavChunk(glbOut$pfx, glbChunks[["last"]]) # called from myevlChunk
# Inspect max OOB FP
#chkObsOOB <- subset(glbObsOOB, !label.fctr.All.X..rcv.glmnet.is.acc)
#chkObsOOBFP <- subset(chkObsOOB, label.fctr.All.X..rcv.glmnet == "left_eye_center") %>% dplyr::mutate(Probability1 = label.fctr.All.X..rcv.glmnet.prob) %>% select(-.src, -.pos, -x, -y) %>% lclgetfltout_df() %>% mutate(obj.distance = (((as.numeric(x) - left_eye_center_x.int) ^ 2) + ((as.numeric(y) - left_eye_center_y.int) ^ 2)) ^ 0.5) %>% dplyr::top_n(5, obj.distance) %>% dplyr::top_n(5, -patch.cor)
#
#newImgObs <- glbObsNew[(glbObsNew$ImageId == "Test#0001"), ]; print(newImgObs[which.max(newImgObs$label.fctr.Final..rcv.glmnet.prob), ])
#OOBImgObs <- glbObsOOB[(glbObsOOB$ImageId == "Train#0003"), ]; print(OOBImgObs[which.max(OOBImgObs$label.fctr.All.X..rcv.glmnet.prob), ])
#load("Votes_Q_02_cnk_extract.features.end.RData", verbose = TRUE)
#mygetImage(which(glbObsAll[, glbFeatsId] == "Train#0003"), names(glbFeatsImage)[1], plot = TRUE, featHighlight = c("left_eye_center_x", "left_eye_center_y"), ovrlHighlight = c(66, 35))
# Depict process
glb_analytics_pn <- petrinet(name = "glb_analytics_pn",
trans_df = data.frame(id = 1:6,
name = c("data.training.all","data.new",
"model.selected","model.final",
"data.training.all.prediction","data.new.prediction"),
x=c( -5,-5,-15,-25,-25,-35),
y=c( -5, 5, 0, 0, -5, 5)
),
places_df=data.frame(id=1:4,
name=c("bgn","fit.data.training.all","predict.data.new","end"),
x=c( -0, -20, -30, -40),
y=c( 0, 0, 0, 0),
M0=c( 3, 0, 0, 0)
),
arcs_df = data.frame(
begin = c("bgn","bgn","bgn",
"data.training.all","model.selected","fit.data.training.all",
"fit.data.training.all","model.final",
"data.new","predict.data.new",
"data.training.all.prediction","data.new.prediction"),
end = c("data.training.all","data.new","model.selected",
"fit.data.training.all","fit.data.training.all","model.final",
"data.training.all.prediction","predict.data.new",
"predict.data.new","data.new.prediction",
"end","end")
))
#print(ggplot.petrinet(glb_analytics_pn))
print(ggplot.petrinet(glb_analytics_pn) + coord_flip())
## Loading required package: grid
glb_analytics_avl_objs <- NULL
glb_chunks_df <- myadd_chunk(NULL,
ifelse(is.null(glbChunks$first), "import.data", glbChunks$first))
## label step_major step_minor label_minor bgn end elapsed
## 1 import.data 1 0 0 11.959 NA NA
1.0: import data## [1] "Reading file ./data/train2016.csv..."
## [1] "dimensions of data in ./data/train2016.csv: 5,568 rows x 108 cols"
## USER_ID YOB Gender Income HouseholdStatus
## 1 1 1938 Male Married (w/kids)
## 2 4 1970 Female over $150,000 Domestic Partners (w/kids)
## 3 5 1997 Male $75,000 - $100,000 Single (no kids)
## 4 8 1983 Male $100,001 - $150,000 Married (w/kids)
## 5 9 1984 Female $50,000 - $74,999 Married (w/kids)
## 6 10 1997 Female over $150,000 Single (no kids)
## EducationLevel Party Q124742 Q124122 Q123464 Q123621 Q122769
## 1 Democrat No No No No
## 2 Bachelor's Degree Democrat Yes No No No
## 3 High School Diploma Republican Yes Yes No
## 4 Bachelor's Degree Democrat No Yes No Yes No
## 5 High School Diploma Republican No Yes No No No
## 6 Current K-12 Democrat No
## Q122770 Q122771 Q122120 Q121699 Q121700 Q120978 Q121011 Q120379 Q120650
## 1 Yes Public No Yes No No No Yes
## 2 Yes Public No Yes No Yes No No Yes
## 3 Yes Private No No No Yes No No Yes
## 4 No Public No Yes No Yes No No Yes
## 5 Yes Public No Yes No Yes Yes No Yes
## 6 Yes Public No No No Yes No Yes Yes
## Q120472 Q120194 Q120012 Q120014 Q119334 Q119851 Q119650 Q118892
## 1 Try first No No Yes Yes
## 2 Science Study first Yes Yes No No Receiving No
## 3 Science Study first Yes No Yes Receiving No
## 4 Science Try first No Yes Yes No Giving Yes
## 5 Art Try first Yes No No No Giving No
## 6 Science Try first Yes Yes No Yes Receiving No
## Q118117 Q118232 Q118233 Q118237 Q117186 Q117193 Q116797
## 1 Yes Idealist No No Yes
## 2 No Pragmatist No No Cool headed Standard hours No
## 3 Yes Pragmatist No Yes Cool headed Odd hours No
## 4 No Idealist No No Cool headed Standard hours No
## 5 No Idealist Yes Yes Hot headed Standard hours No
## 6 No Pragmatist No No Standard hours
## Q116881 Q116953 Q116601 Q116441 Q116448 Q116197 Q115602 Q115777 Q115610
## 1 Happy Yes Yes No No P.M. Yes Start Yes
## 2 Happy Yes Yes Yes No A.M. No End Yes
## 3 Right Yes No No Yes A.M. Yes Start Yes
## 4 Happy Yes Yes No No A.M. Yes Start Yes
## 5 Happy Yes Yes No Yes P.M. No End No
## 6
## Q115611 Q115899 Q115390 Q114961 Q114748 Q115195 Q114517 Q114386
## 1 No Circumstances Yes Yes Yes Yes No
## 2 No Me Yes Yes No Yes No Mysterious
## 3 Yes Circumstances No Yes No Yes Yes Mysterious
## 4 No Circumstances Yes No No Yes No TMI
## 5 No Me No Yes Yes Yes Yes TMI
## 6
## Q113992 Q114152 Q113583 Q113584 Q113181 Q112478 Q112512 Q112270
## 1 Yes Yes Talk Technology No No Yes
## 2 No No
## 3 No No Tunes Technology Yes Yes Yes Yes
## 4 No No Talk People No Yes Yes Yes
## 5 Yes No Tunes People No No Yes No
## 6
## Q111848 Q111580 Q111220 Q110740 Q109367 Q108950 Q109244 Q108855
## 1 No Demanding No No Cautious No Yes!
## 2 Mac Yes Cautious No Umm...
## 3 No Supportive No PC No Cautious No Umm...
## 4 Yes Supportive No Mac Yes Risk-friendly No Umm...
## 5 No Demanding Yes PC Yes Cautious No Yes!
## 6 Yes Supportive No PC
## Q108617 Q108856 Q108754 Q108342 Q108343 Q107869 Q107491 Q106993
## 1 No Space No In-person Yes No Yes
## 2 No Space Yes In-person No Yes Yes No
## 3 No Space No In-person No No Yes Yes
## 4 No Socialize Yes Online No Yes No Yes
## 5 No Socialize No Online No No Yes Yes
## 6 In-person No No Yes Yes
## Q106997 Q106272 Q106388 Q106389 Q106042 Q105840 Q105655 Q104996
## 1 Yay people! Yes No Yes Yes No Yes
## 2 Yay people! Yes Yes Yes Yes Yes No Yes
## 3 Grrr people Yes No No No No No No
## 4 Grrr people No No Yes Yes No Yes Yes
## 5 Yay people! Yes No Yes Yes Yes Yes No
## 6 Grrr people Yes No Yes Yes No No Yes
## Q103293 Q102906 Q102674 Q102687 Q102289 Q102089 Q101162 Q101163
## 1 No No No Yes No Own Optimist
## 2
## 3 Yes No No Yes No Own Pessimist Mom
## 4 No No No Yes Yes Own Optimist Mom
## 5 No No Yes No No Own Optimist Mom
## 6 Yes Yes No Yes
## Q101596 Q100689 Q100680 Q100562 Q99982 Q100010 Q99716 Q99581 Q99480
## 1 Yes Yes No No Nope Yes No No
## 2 No
## 3 No No No No Nope Yes No No No
## 4 No No No Yes Check! No No No Yes
## 5 No Yes Yes Yes Nope Yes No No Yes
## 6
## Q98869 Q98578 Q98059 Q98078 Q98197 Q96024
## 1 No Only-child No No Yes
## 2 No No Only-child Yes No No
## 3 Yes No Yes No Yes No
## 4 Yes No Yes No No Yes
## 5 No No Yes No No Yes
## 6
## USER_ID YOB Gender Income HouseholdStatus
## 193 245 1964 Male over $150,000 Married (w/kids)
## 848 1046 1953 Male $100,001 - $150,000 Domestic Partners (no kids)
## 2836 3530 1995 Male Single (no kids)
## 4052 5050 1945 Female $75,000 - $100,000 Married (w/kids)
## 4093 5107 1980 Female $100,001 - $150,000 Married (w/kids)
## 5509 6888 1998 Female under $25,000 Single (no kids)
## EducationLevel Party Q124742 Q124122 Q123464 Q123621
## 193 Bachelor's Degree Republican Yes Yes No Yes
## 848 Democrat
## 2836 Current Undergraduate Democrat Yes Yes Yes No
## 4052 Bachelor's Degree Republican
## 4093 Bachelor's Degree Democrat No No
## 5509 Current K-12 Republican
## Q122769 Q122770 Q122771 Q122120 Q121699 Q121700 Q120978 Q121011
## 193 No Yes Public No Yes No Yes No
## 848
## 2836 Yes Public Yes No No Yes Yes
## 4052 No Public
## 4093 No No Private No
## 5509 Yes Yes
## Q120379 Q120650 Q120472 Q120194 Q120012 Q120014 Q119334 Q119851
## 193 No Yes Science Try first Yes Yes Yes No
## 848
## 2836 Yes Yes Art Study first No Yes Yes
## 4052
## 4093 Yes
## 5509 Yes No Art Study first Yes No Yes No
## Q119650 Q118892 Q118117 Q118232 Q118233 Q118237 Q117186
## 193 Giving Yes No Idealist Yes Yes Hot headed
## 848
## 2836 Yes Yes Idealist Yes No Cool headed
## 4052 No No No
## 4093 No No Pragmatist No Yes
## 5509 Giving No
## Q117193 Q116797 Q116881 Q116953 Q116601 Q116441 Q116448
## 193 Standard hours No Happy Yes Yes No No
## 848
## 2836 Odd hours No Happy Yes Yes No
## 4052
## 4093
## 5509
## Q116197 Q115602 Q115777 Q115610 Q115611 Q115899 Q115390 Q114961
## 193 A.M. Yes End Yes Yes Me No No
## 848
## 2836 Yes End Yes No Circumstances Yes No
## 4052 P.M. Yes Start Yes No No
## 4093 P.M. Yes Start Yes No Circumstances
## 5509
## Q114748 Q115195 Q114517 Q114386 Q113992 Q114152 Q113583 Q113584
## 193 Yes No Yes TMI No Yes Tunes Technology
## 848
## 2836 Yes No No Mysterious No Yes Tunes People
## 4052 No Yes
## 4093 Tunes People
## 5509
## Q113181 Q112478 Q112512 Q112270 Q111848 Q111580 Q111220 Q110740
## 193 No Yes Yes Yes Supportive No Mac
## 848
## 2836 Yes Yes Yes No Yes Demanding Yes PC
## 4052
## 4093 Yes Supportive
## 5509
## Q109367 Q108950 Q109244 Q108855 Q108617 Q108856 Q108754
## 193 No Cautious No Yes! No Socialize No
## 848 Yes Risk-friendly Yes Yes! No Space No
## 2836 Yes Cautious Yes Yes
## 4052
## 4093 No Risk-friendly No Yes! No Space No
## 5509
## Q108342 Q108343 Q107869 Q107491 Q106993 Q106997 Q106272 Q106388
## 193 In-person No Yes Yes No Yay people! Yes Yes
## 848 In-person Yes
## 2836 In-person Yes Yes Yes No
## 4052 No Grrr people
## 4093 In-person Yes Yes Yes Yes Yay people! Yes Yes
## 5509
## Q106389 Q106042 Q105840 Q105655 Q104996 Q103293 Q102906 Q102674
## 193 No Yes No No Yes No No No
## 848
## 2836 Yes No No No Yes Yes No No
## 4052 No No No No
## 4093 No No No No Yes No No Yes
## 5509
## Q102687 Q102289 Q102089 Q101162 Q101163 Q101596 Q100689 Q100680
## 193 No No Own Optimist Dad Yes Yes No
## 848
## 2836 Yes Yes Rent Optimist Dad No Yes Yes
## 4052 Yes Own No
## 4093 Yes Yes Rent No Yes
## 5509
## Q100562 Q99982 Q100010 Q99716 Q99581 Q99480 Q98869 Q98578 Q98059
## 193 Yes Check! No No No Yes Yes No Yes
## 848
## 2836 Yes Check! No No No Yes Yes Yes
## 4052
## 4093 No Nope Yes No Yes Yes Yes No Yes
## 5509
## Q98078 Q98197 Q96024
## 193 No Yes Yes
## 848 No
## 2836 Yes Yes No
## 4052
## 4093 Yes Yes No
## 5509
## USER_ID YOB Gender Income HouseholdStatus
## 5563 6955 1966 Male over $150,000 Married (w/kids)
## 5564 6956 NA Male
## 5565 6957 2000 Female
## 5566 6958 1969 Male over $150,000
## 5567 6959 1986 Male $25,001 - $50,000 Married (w/kids)
## 5568 6960 1999 Male under $25,000 Single (no kids)
## EducationLevel Party Q124742 Q124122 Q123464 Q123621
## 5563 Bachelor's Degree Democrat
## 5564 Master's Degree Democrat No No
## 5565 Current K-12 Republican
## 5566 Bachelor's Degree Democrat Yes
## 5567 High School Diploma Republican
## 5568 Current K-12 Republican
## Q122769 Q122770 Q122771 Q122120 Q121699 Q121700 Q120978 Q121011
## 5563 No Yes No Yes Yes
## 5564 No Yes Public Yes
## 5565 Public Yes
## 5566 No No No Yes Yes
## 5567 Yes Yes No
## 5568 Yes No No
## Q120379 Q120650 Q120472 Q120194 Q120012 Q120014 Q119334 Q119851
## 5563
## 5564
## 5565 Yes Yes Art Try first No Yes Yes Yes
## 5566 Yes Yes Science
## 5567 No No Science No Yes
## 5568
## Q119650 Q118892 Q118117 Q118232 Q118233 Q118237 Q117186 Q117193
## 5563
## 5564
## 5565 Receiving
## 5566
## 5567
## 5568
## Q116797 Q116881 Q116953 Q116601 Q116441 Q116448 Q116197 Q115602
## 5563
## 5564
## 5565
## 5566
## 5567
## 5568
## Q115777 Q115610 Q115611 Q115899 Q115390 Q114961 Q114748 Q115195
## 5563
## 5564
## 5565
## 5566
## 5567
## 5568
## Q114517 Q114386 Q113992 Q114152 Q113583 Q113584 Q113181 Q112478
## 5563
## 5564
## 5565
## 5566
## 5567
## 5568
## Q112512 Q112270 Q111848 Q111580 Q111220 Q110740 Q109367 Q108950
## 5563
## 5564
## 5565
## 5566
## 5567
## 5568
## Q109244 Q108855 Q108617 Q108856 Q108754 Q108342 Q108343 Q107869
## 5563
## 5564
## 5565
## 5566
## 5567
## 5568
## Q107491 Q106993 Q106997 Q106272 Q106388 Q106389 Q106042 Q105840
## 5563
## 5564
## 5565
## 5566
## 5567
## 5568
## Q105655 Q104996 Q103293 Q102906 Q102674 Q102687 Q102289 Q102089
## 5563
## 5564
## 5565
## 5566
## 5567
## 5568
## Q101162 Q101163 Q101596 Q100689 Q100680 Q100562 Q99982 Q100010 Q99716
## 5563
## 5564
## 5565
## 5566
## 5567
## 5568
## Q99581 Q99480 Q98869 Q98578 Q98059 Q98078 Q98197 Q96024
## 5563
## 5564
## 5565
## 5566
## 5567
## 5568
## 'data.frame': 5568 obs. of 20 variables:
## $ USER_ID : int 1 4 5 8 9 10 11 12 13 15 ...
## $ YOB : int 1938 1970 1997 1983 1984 1997 1983 1996 NA 1981 ...
## $ Gender : chr "Male" "Female" "Male" "Male" ...
## $ Income : chr "" "over $150,000" "$75,000 - $100,000" "$100,001 - $150,000" ...
## $ HouseholdStatus: chr "Married (w/kids)" "Domestic Partners (w/kids)" "Single (no kids)" "Married (w/kids)" ...
## $ EducationLevel : chr "" "Bachelor's Degree" "High School Diploma" "Bachelor's Degree" ...
## $ Party : chr "Democrat" "Democrat" "Republican" "Democrat" ...
## $ Q124742 : chr "No" "" "" "No" ...
## $ Q124122 : chr "" "Yes" "Yes" "Yes" ...
## $ Q123464 : chr "No" "No" "Yes" "No" ...
## $ Q123621 : chr "No" "No" "No" "Yes" ...
## $ Q122769 : chr "No" "No" "" "No" ...
## $ Q122770 : chr "Yes" "Yes" "Yes" "No" ...
## $ Q122771 : chr "Public" "Public" "Private" "Public" ...
## $ Q122120 : chr "No" "No" "No" "No" ...
## $ Q121699 : chr "Yes" "Yes" "No" "Yes" ...
## $ Q121700 : chr "No" "No" "No" "No" ...
## $ Q120978 : chr "" "Yes" "Yes" "Yes" ...
## $ Q121011 : chr "No" "No" "No" "No" ...
## $ Q120379 : chr "No" "No" "No" "No" ...
## NULL
## 'data.frame': 5568 obs. of 20 variables:
## $ Q120650: chr "Yes" "Yes" "Yes" "Yes" ...
## $ Q118117: chr "Yes" "No" "Yes" "No" ...
## $ Q118233: chr "No" "No" "No" "No" ...
## $ Q118237: chr "No" "No" "Yes" "No" ...
## $ Q116441: chr "No" "Yes" "No" "No" ...
## $ Q116197: chr "P.M." "A.M." "A.M." "A.M." ...
## $ Q115611: chr "No" "No" "Yes" "No" ...
## $ Q115899: chr "Circumstances" "Me" "Circumstances" "Circumstances" ...
## $ Q115390: chr "Yes" "Yes" "No" "Yes" ...
## $ Q114748: chr "Yes" "No" "No" "No" ...
## $ Q115195: chr "Yes" "Yes" "Yes" "Yes" ...
## $ Q113584: chr "Technology" "" "Technology" "People" ...
## $ Q112478: chr "No" "" "Yes" "Yes" ...
## $ Q112270: chr "" "" "Yes" "Yes" ...
## $ Q111848: chr "No" "" "No" "Yes" ...
## $ Q106993: chr "Yes" "No" "Yes" "Yes" ...
## $ Q106388: chr "No" "Yes" "No" "No" ...
## $ Q105655: chr "No" "No" "No" "Yes" ...
## $ Q104996: chr "Yes" "Yes" "No" "Yes" ...
## $ Q102674: chr "No" "" "No" "No" ...
## NULL
## 'data.frame': 5568 obs. of 21 variables:
## $ Q102674: chr "No" "" "No" "No" ...
## $ Q102687: chr "Yes" "" "Yes" "Yes" ...
## $ Q102289: chr "No" "" "No" "Yes" ...
## $ Q102089: chr "Own" "" "Own" "Own" ...
## $ Q101162: chr "Optimist" "" "Pessimist" "Optimist" ...
## $ Q101163: chr "" "" "Mom" "Mom" ...
## $ Q101596: chr "Yes" "" "No" "No" ...
## $ Q100689: chr "Yes" "" "No" "No" ...
## $ Q100680: chr "No" "" "No" "No" ...
## $ Q100562: chr "No" "" "No" "Yes" ...
## $ Q99982 : chr "Nope" "" "Nope" "Check!" ...
## $ Q100010: chr "Yes" "" "Yes" "No" ...
## $ Q99716 : chr "No" "" "No" "No" ...
## $ Q99581 : chr "No" "" "No" "No" ...
## $ Q99480 : chr "" "No" "No" "Yes" ...
## $ Q98869 : chr "No" "No" "Yes" "Yes" ...
## $ Q98578 : chr "" "No" "No" "No" ...
## $ Q98059 : chr "Only-child" "Only-child" "Yes" "Yes" ...
## $ Q98078 : chr "No" "Yes" "No" "No" ...
## $ Q98197 : chr "No" "No" "Yes" "No" ...
## $ Q96024 : chr "Yes" "No" "No" "Yes" ...
## NULL
## Warning in myprint_str_df(obsDf): [list output truncated]
## [1] "Reading file ./data/test2016.csv..."
## [1] "dimensions of data in ./data/test2016.csv: 1,392 rows x 107 cols"
## USER_ID YOB Gender Income HouseholdStatus
## 1 2 1985 Female $25,001 - $50,000 Single (no kids)
## 2 3 1983 Male $50,000 - $74,999 Married (w/kids)
## 3 6 1995 Male $75,000 - $100,000 Single (no kids)
## 4 7 1980 Female $50,000 - $74,999 Single (no kids)
## 5 14 1980 Female Married (no kids)
## 6 28 1973 Male over $150,000 Married (no kids)
## EducationLevel Q124742 Q124122 Q123464 Q123621 Q122769 Q122770
## 1 Master's Degree Yes No Yes No No
## 2 Current Undergraduate No Yes Yes
## 3 Current K-12
## 4 Master's Degree Yes Yes No Yes Yes Yes
## 5 Current Undergraduate Yes No Yes No No
## 6 Master's Degree No Yes No Yes No No
## Q122771 Q122120 Q121699 Q121700 Q120978 Q121011 Q120379 Q120650 Q120472
## 1 Public No Yes Yes Yes No Yes Yes Science
## 2 Public No Yes No
## 3 No No No Yes No Yes Science
## 4 Public No Yes No Yes No Yes Yes Science
## 5 Public Yes Yes No Yes Yes No Yes Art
## 6 Public No Yes No Yes Yes Yes Yes Science
## Q120194 Q120012 Q120014 Q119334 Q119851 Q119650 Q118892 Q118117
## 1 Study first Yes Yes Yes No Giving Yes No
## 2 Study first No Yes No
## 3 Try first No Yes No Yes Giving
## 4 Try first Yes No No Yes Giving Yes Yes
## 5 Try first Yes Yes Yes Yes Giving No No
## 6 Try first Yes Yes No No Giving No Yes
## Q118232 Q118233 Q118237 Q117186 Q117193 Q116797 Q116881
## 1 Idealist No Yes Cool headed Odd hours Yes Happy
## 2
## 3
## 4 Idealist No No Cool headed Standard hours No Happy
## 5 Idealist No Yes Hot headed Standard hours Yes Happy
## 6 Pragmatist Yes No Hot headed Odd hours Yes Right
## Q116953 Q116601 Q116441 Q116448 Q116197 Q115602 Q115777 Q115610 Q115611
## 1 Yes Yes No Yes A.M. Yes End Yes No
## 2 Yes Yes P.M.
## 3 Yes
## 4 Yes No No Yes A.M. Yes Start Yes No
## 5 Yes Yes Yes No P.M. Yes End No No
## 6 Yes Yes Yes Yes P.M. End Yes Yes
## Q115899 Q115390 Q114961 Q114748 Q115195 Q114517 Q114386 Q113992
## 1 Me No Yes No Yes Yes TMI
## 2 No Yes
## 3 Yes No Yes Yes No TMI No
## 4 Me Yes No Yes Yes Yes TMI No
## 5 Me No No No Yes No TMI No
## 6 Circumstances No Yes No Yes No TMI Yes
## Q114152 Q113583 Q113584 Q113181 Q112478 Q112512 Q112270 Q111848
## 1 No Tunes People Yes Yes No Yes Yes
## 2 No No No Yes
## 3 No Tunes Technology Yes No Yes No
## 4 Yes Talk People No No Yes No Yes
## 5 Tunes Technology No Yes Yes Yes
## 6 No Talk Technology No Yes Yes No Yes
## Q111580 Q111220 Q110740 Q109367 Q108950 Q109244 Q108855 Q108617
## 1 Supportive No Yes Cautious Yes Yes!
## 2 No Yes Cautious No Yes! No
## 3 No No No
## 4 Supportive No PC No Cautious Yes Yes! No
## 5 Supportive Yes Mac Yes Cautious No Yes! No
## 6 Demanding No PC Yes Cautious No Umm... No
## Q108856 Q108754 Q108342 Q108343 Q107869 Q107491 Q106993 Q106997
## 1 Yes In-person Yes
## 2 Space No Yes Yes Yes Grrr people
## 3 Yes In-person No No Yes Yes Yay people!
## 4 Space No Online No No Yes Yes Yay people!
## 5 Space No In-person No No Yes No Grrr people
## 6 Space No In-person Yes Yes Yes Grrr people
## Q106272 Q106388 Q106389 Q106042 Q105840 Q105655 Q104996 Q103293 Q102906
## 1
## 2 Yes No No Yes No Yes No No
## 3 Yes No Yes No No Yes Yes No No
## 4 No No No No No Yes Yes No No
## 5 No No No Yes Yes Yes Yes Yes No
## 6 Yes No Yes Yes No No No Yes Yes
## Q102674 Q102687 Q102289 Q102089 Q101162 Q101163 Q101596 Q100689
## 1 No
## 2 Rent Pessimist Dad
## 3 No No Yes Own Optimist Mom No No
## 4 No No No Own Optimist Dad No No
## 5 Yes No No Own Pessimist Mom No Yes
## 6 Yes Yes No Own Pessimist Mom No Yes
## Q100680 Q100562 Q99982 Q100010 Q99716 Q99581 Q99480 Q98869 Q98578 Q98059
## 1 Yes Yes Yes
## 2 Yes Yes Yes
## 3 Yes Yes Nope No No No Yes Yes No Yes
## 4 Yes Yes Nope Yes No No No Yes No Yes
## 5 Yes Yes Nope Yes No No Yes No No Yes
## 6 Yes Yes Nope Yes No No Yes No No Yes
## Q98078 Q98197 Q96024
## 1
## 2 Yes No Yes
## 3 No Yes Yes
## 4 No No Yes
## 5 No No No
## 6 No No Yes
## USER_ID YOB Gender Income HouseholdStatus
## 503 2555 1956 Male over $150,000 Married (w/kids)
## 515 2616 1959 Male over $150,000 Married (w/kids)
## 857 4346 1990 Female $50,000 - $74,999
## 950 4814 1969 Male $75,000 - $100,000 Married (w/kids)
## 1207 6057 1937 Female $25,001 - $50,000 Married (no kids)
## 1255 6285 1976 Female $100,001 - $150,000 Married (no kids)
## EducationLevel Q124742 Q124122 Q123464 Q123621 Q122769 Q122770
## 503 Bachelor's Degree No No No Yes No Yes
## 515 Bachelor's Degree
## 857 Bachelor's Degree
## 950 Bachelor's Degree Yes No Yes No No
## 1207 Bachelor's Degree No Yes
## 1255 Bachelor's Degree
## Q122771 Q122120 Q121699 Q121700 Q120978 Q121011 Q120379 Q120650
## 503 Private No Yes No No Yes No Yes
## 515 No No
## 857 No Yes No No No No Yes
## 950 Public Yes Yes No Yes Yes No Yes
## 1207 Public No Yes No No No No
## 1255
## Q120472 Q120194 Q120012 Q120014 Q119334 Q119851 Q119650 Q118892
## 503 Science Study first No Yes No Yes Giving Yes
## 515 Yes
## 857 Science Study first No No Yes No Receiving Yes
## 950 Science Study first No No No No Giving No
## 1207 Study first No No Yes Receiving Yes
## 1255
## Q118117 Q118232 Q118233 Q118237 Q117186 Q117193 Q116797
## 503 No Pragmatist No No Cool headed Standard hours No
## 515 No Pragmatist No Yes Cool headed Standard hours No
## 857 Yes Pragmatist No No Cool headed Odd hours No
## 950 No Pragmatist No Yes Hot headed Odd hours Yes
## 1207 No Pragmatist No No Hot headed No
## 1255
## Q116881 Q116953 Q116601 Q116441 Q116448 Q116197 Q115602 Q115777
## 503 Happy Yes Yes No No A.M. Yes End
## 515 Right Yes Yes No Yes Yes
## 857 Right Yes Yes No No A.M. Yes Start
## 950 Happy Yes Yes Yes No P.M. Yes Start
## 1207 Happy Yes Yes No No A.M. Yes Start
## 1255 Yes No Yes A.M. Yes Start
## Q115610 Q115611 Q115899 Q115390 Q114961 Q114748 Q115195 Q114517
## 503 Yes Yes Me No No No Yes Yes
## 515 Yes No Me Yes No Yes Yes No
## 857 Yes No Me No No No Yes
## 950 Yes No Me Yes No Yes No No
## 1207 No No Circumstances Yes No Yes No Yes
## 1255 Yes No Circumstances No Yes No Yes Yes
## Q114386 Q113992 Q114152 Q113583 Q113584 Q113181 Q112478 Q112512
## 503 TMI Yes Yes Tunes People Yes No Yes
## 515 No Yes Talk Technology
## 857 Mysterious No No Tunes People No No No
## 950 Mysterious No No Tunes People Yes Yes Yes
## 1207 Yes No Talk Yes
## 1255 TMI Yes Yes Yes
## Q112270 Q111848 Q111580 Q111220 Q110740 Q109367 Q108950
## 503 No Yes Demanding No PC No Cautious
## 515 No Yes No Mac Yes
## 857 Yes Yes Supportive No Mac No Risk-friendly
## 950 No Yes Supportive Yes PC No Cautious
## 1207 Supportive No PC Cautious
## 1255 Yes Yes Demanding No Mac
## Q109244 Q108855 Q108617 Q108856 Q108754 Q108342 Q108343 Q107869
## 503 No Umm... No Space No In-person No Yes
## 515
## 857 Yes Umm... No Space No In-person No Yes
## 950 No Yes! No Space No In-person No No
## 1207 Yes! No Space No In-person No Yes
## 1255
## Q107491 Q106993 Q106997 Q106272 Q106388 Q106389 Q106042 Q105840
## 503 Yes Yes Yay people! Yes No No Yes No
## 515 No
## 857 No Yes Grrr people Yes No Yes No No
## 950 Yes No Grrr people Yes Yes No No No
## 1207 Yes Yes Yes
## 1255
## Q105655 Q104996 Q103293 Q102906 Q102674 Q102687 Q102289 Q102089
## 503 No Yes No No No Yes No Own
## 515 Yes Yes
## 857 No Yes Yes No No Yes Yes Own
## 950 Yes Yes Yes No No Yes No Own
## 1207 Yes
## 1255
## Q101162 Q101163 Q101596 Q100689 Q100680 Q100562 Q99982 Q100010
## 503 Pessimist Mom Yes Yes No Yes Check! Yes
## 515 Check! Yes
## 857 Optimist Mom No Yes Yes No Nope Yes
## 950 Pessimist Mom Yes No No No Check! Yes
## 1207
## 1255
## Q99716 Q99581 Q99480 Q98869 Q98578 Q98059 Q98078 Q98197 Q96024
## 503 No No Yes Yes No Yes Yes Yes Yes
## 515 No Yes Yes Yes No Yes Yes
## 857 No Yes Yes Yes No Yes No No No
## 950 No No Yes Yes No Yes No Yes Yes
## 1207
## 1255
## USER_ID YOB Gender Income HouseholdStatus
## 1387 6922 1988 Male $50,000 - $74,999 Single (no kids)
## 1388 6928 1977 Female $50,000 - $74,999 Domestic Partners (no kids)
## 1389 6930 1998 Female $100,001 - $150,000 Single (no kids)
## 1390 6941 1989 Male $25,001 - $50,000 Married (no kids)
## 1391 6946 1996 Male
## 1392 6947 NA Female
## EducationLevel Q124742 Q124122 Q123464 Q123621 Q122769 Q122770
## 1387 Master's Degree
## 1388 Master's Degree
## 1389 Current K-12 No No
## 1390 Bachelor's Degree
## 1391 Current K-12
## 1392 Yes Yes No No No No
## Q122771 Q122120 Q121699 Q121700 Q120978 Q121011 Q120379 Q120650
## 1387 Yes Yes Yes Yes Yes Yes
## 1388 Yes No Yes
## 1389 Public Yes Yes Yes Yes Yes Yes Yes
## 1390 Yes Yes No No No
## 1391 Yes No No Yes No Yes Yes
## 1392 Public Yes Yes No Yes Yes Yes Yes
## Q120472 Q120194 Q120012 Q120014 Q119334 Q119851 Q119650 Q118892
## 1387 Science Try first No Yes Yes No Giving
## 1388 Art
## 1389 Art Study first Yes No Yes No Giving
## 1390
## 1391 Art Study first Yes Yes Yes No Giving
## 1392 Art No No No Yes Giving
## Q118117 Q118232 Q118233 Q118237 Q117186 Q117193 Q116797 Q116881
## 1387
## 1388
## 1389
## 1390
## 1391
## 1392
## Q116953 Q116601 Q116441 Q116448 Q116197 Q115602 Q115777 Q115610
## 1387
## 1388
## 1389
## 1390
## 1391
## 1392
## Q115611 Q115899 Q115390 Q114961 Q114748 Q115195 Q114517 Q114386
## 1387
## 1388
## 1389
## 1390
## 1391
## 1392
## Q113992 Q114152 Q113583 Q113584 Q113181 Q112478 Q112512 Q112270
## 1387
## 1388
## 1389
## 1390
## 1391
## 1392
## Q111848 Q111580 Q111220 Q110740 Q109367 Q108950 Q109244 Q108855
## 1387
## 1388
## 1389
## 1390
## 1391
## 1392
## Q108617 Q108856 Q108754 Q108342 Q108343 Q107869 Q107491 Q106993
## 1387
## 1388
## 1389
## 1390
## 1391
## 1392
## Q106997 Q106272 Q106388 Q106389 Q106042 Q105840 Q105655 Q104996
## 1387
## 1388
## 1389
## 1390
## 1391
## 1392
## Q103293 Q102906 Q102674 Q102687 Q102289 Q102089 Q101162 Q101163
## 1387
## 1388
## 1389
## 1390
## 1391
## 1392
## Q101596 Q100689 Q100680 Q100562 Q99982 Q100010 Q99716 Q99581 Q99480
## 1387
## 1388
## 1389
## 1390
## 1391
## 1392
## Q98869 Q98578 Q98059 Q98078 Q98197 Q96024
## 1387
## 1388
## 1389
## 1390
## 1391
## 1392
## 'data.frame': 1392 obs. of 20 variables:
## $ USER_ID : int 2 3 6 7 14 28 29 37 44 56 ...
## $ YOB : int 1985 1983 1995 1980 1980 1973 1968 1961 1989 1975 ...
## $ Gender : chr "Female" "Male" "Male" "Female" ...
## $ Income : chr "$25,001 - $50,000" "$50,000 - $74,999" "$75,000 - $100,000" "$50,000 - $74,999" ...
## $ HouseholdStatus: chr "Single (no kids)" "Married (w/kids)" "Single (no kids)" "Single (no kids)" ...
## $ EducationLevel : chr "Master's Degree" "Current Undergraduate" "Current K-12" "Master's Degree" ...
## $ Q124742 : chr "" "" "" "Yes" ...
## $ Q124122 : chr "Yes" "" "" "Yes" ...
## $ Q123464 : chr "No" "No" "" "No" ...
## $ Q123621 : chr "Yes" "" "" "Yes" ...
## $ Q122769 : chr "No" "Yes" "" "Yes" ...
## $ Q122770 : chr "No" "Yes" "" "Yes" ...
## $ Q122771 : chr "Public" "Public" "" "Public" ...
## $ Q122120 : chr "No" "No" "" "No" ...
## $ Q121699 : chr "Yes" "Yes" "No" "Yes" ...
## $ Q121700 : chr "Yes" "No" "No" "No" ...
## $ Q120978 : chr "Yes" "" "No" "Yes" ...
## $ Q121011 : chr "No" "" "Yes" "No" ...
## $ Q120379 : chr "Yes" "" "No" "Yes" ...
## $ Q120650 : chr "Yes" "" "Yes" "Yes" ...
## NULL
## 'data.frame': 1392 obs. of 20 variables:
## $ Q120012: chr "Yes" "No" "No" "Yes" ...
## $ Q120014: chr "Yes" "Yes" "Yes" "No" ...
## $ Q118117: chr "No" "" "" "Yes" ...
## $ Q118237: chr "Yes" "" "" "No" ...
## $ Q116953: chr "Yes" "Yes" "Yes" "Yes" ...
## $ Q116601: chr "Yes" "Yes" "" "No" ...
## $ Q116448: chr "Yes" "" "" "Yes" ...
## $ Q116197: chr "A.M." "P.M." "" "A.M." ...
## $ Q115899: chr "Me" "" "" "Me" ...
## $ Q114961: chr "Yes" "" "No" "No" ...
## $ Q113584: chr "People" "" "Technology" "People" ...
## $ Q113181: chr "Yes" "No" "Yes" "No" ...
## $ Q112512: chr "No" "" "Yes" "Yes" ...
## $ Q108950: chr "Cautious" "Cautious" "" "Cautious" ...
## $ Q108617: chr "" "No" "No" "No" ...
## $ Q108342: chr "In-person" "" "In-person" "Online" ...
## $ Q107491: chr "" "Yes" "Yes" "Yes" ...
## $ Q106272: chr "" "Yes" "Yes" "No" ...
## $ Q106389: chr "" "No" "Yes" "No" ...
## $ Q104996: chr "" "No" "Yes" "Yes" ...
## NULL
## 'data.frame': 1392 obs. of 21 variables:
## $ Q102674: chr "" "" "No" "No" ...
## $ Q102687: chr "" "" "No" "No" ...
## $ Q102289: chr "" "" "Yes" "No" ...
## $ Q102089: chr "" "Rent" "Own" "Own" ...
## $ Q101162: chr "" "Pessimist" "Optimist" "Optimist" ...
## $ Q101163: chr "" "Dad" "Mom" "Dad" ...
## $ Q101596: chr "" "" "No" "No" ...
## $ Q100689: chr "No" "" "No" "No" ...
## $ Q100680: chr "Yes" "" "Yes" "Yes" ...
## $ Q100562: chr "Yes" "Yes" "Yes" "Yes" ...
## $ Q99982 : chr "" "" "Nope" "Nope" ...
## $ Q100010: chr "" "" "No" "Yes" ...
## $ Q99716 : chr "" "" "No" "No" ...
## $ Q99581 : chr "" "" "No" "No" ...
## $ Q99480 : chr "" "" "Yes" "No" ...
## $ Q98869 : chr "Yes" "Yes" "Yes" "Yes" ...
## $ Q98578 : chr "" "" "No" "No" ...
## $ Q98059 : chr "" "Yes" "Yes" "Yes" ...
## $ Q98078 : chr "" "Yes" "No" "No" ...
## $ Q98197 : chr "" "No" "Yes" "No" ...
## $ Q96024 : chr "" "Yes" "Yes" "Yes" ...
## NULL
## Warning in myprint_str_df(obsDf): [list output truncated]
## [1] "Creating new feature: .pos..."
## [1] "Creating new feature: YOB.Age.fctr..."
## [1] "Creating new feature: YOB.Age.dff..."
## [1] "Creating new feature: Gender.fctr..."
## [1] "Creating new feature: Income.fctr..."
## [1] "Creating new feature: Hhold.fctr..."
## [1] "Creating new feature: Edn.fctr..."
## [1] "Creating new feature: Q124742.fctr..."
## [1] "Creating new feature: Q124122.fctr..."
## [1] "Creating new feature: Q123621.fctr..."
## [1] "Creating new feature: Q123464.fctr..."
## [1] "Creating new feature: Q122771.fctr..."
## [1] "Creating new feature: Q122770.fctr..."
## [1] "Creating new feature: Q122769.fctr..."
## [1] "Creating new feature: Q122120.fctr..."
## [1] "Creating new feature: Q121700.fctr..."
## [1] "Creating new feature: Q121699.fctr..."
## [1] "Creating new feature: Q121011.fctr..."
## [1] "Creating new feature: Q120978.fctr..."
## [1] "Creating new feature: Q120650.fctr..."
## [1] "Creating new feature: Q120472.fctr..."
## [1] "Creating new feature: Q120379.fctr..."
## [1] "Creating new feature: Q120194.fctr..."
## [1] "Creating new feature: Q120014.fctr..."
## [1] "Creating new feature: Q120012.fctr..."
## [1] "Creating new feature: Q119851.fctr..."
## [1] "Creating new feature: Q119650.fctr..."
## [1] "Creating new feature: Q119334.fctr..."
## [1] "Creating new feature: Q118892.fctr..."
## [1] "Creating new feature: Q118237.fctr..."
## [1] "Creating new feature: Q118233.fctr..."
## [1] "Creating new feature: Q118232.fctr..."
## [1] "Creating new feature: Q118117.fctr..."
## [1] "Creating new feature: Q117193.fctr..."
## [1] "Creating new feature: Q117186.fctr..."
## [1] "Creating new feature: Q116797.fctr..."
## [1] "Creating new feature: Q116881.fctr..."
## [1] "Creating new feature: Q116953.fctr..."
## [1] "Creating new feature: Q116601.fctr..."
## [1] "Creating new feature: Q116441.fctr..."
## [1] "Creating new feature: Q116448.fctr..."
## [1] "Creating new feature: Q116197.fctr..."
## [1] "Creating new feature: Q115602.fctr..."
## [1] "Creating new feature: Q115777.fctr..."
## [1] "Creating new feature: Q115610.fctr..."
## [1] "Creating new feature: Q115611.fctr..."
## [1] "Creating new feature: Q115899.fctr..."
## [1] "Creating new feature: Q115390.fctr..."
## [1] "Creating new feature: Q115195.fctr..."
## [1] "Creating new feature: Q114961.fctr..."
## [1] "Creating new feature: Q114748.fctr..."
## [1] "Creating new feature: Q114517.fctr..."
## [1] "Creating new feature: Q114386.fctr..."
## [1] "Creating new feature: Q114152.fctr..."
## [1] "Creating new feature: Q113992.fctr..."
## [1] "Creating new feature: Q113583.fctr..."
## [1] "Creating new feature: Q113584.fctr..."
## [1] "Creating new feature: Q113181.fctr..."
## [1] "Creating new feature: Q112478.fctr..."
## [1] "Creating new feature: Q112512.fctr..."
## [1] "Creating new feature: Q112270.fctr..."
## [1] "Creating new feature: Q111848.fctr..."
## [1] "Creating new feature: Q111580.fctr..."
## [1] "Creating new feature: Q111220.fctr..."
## [1] "Creating new feature: Q110740.fctr..."
## [1] "Creating new feature: Q109367.fctr..."
## [1] "Creating new feature: Q109244.fctr..."
## [1] "Creating new feature: Q108950.fctr..."
## [1] "Creating new feature: Q108855.fctr..."
## [1] "Creating new feature: Q108617.fctr..."
## [1] "Creating new feature: Q108856.fctr..."
## [1] "Creating new feature: Q108754.fctr..."
## [1] "Creating new feature: Q108342.fctr..."
## [1] "Creating new feature: Q108343.fctr..."
## [1] "Creating new feature: Q107869.fctr..."
## [1] "Creating new feature: Q107491.fctr..."
## [1] "Creating new feature: Q106993.fctr..."
## [1] "Creating new feature: Q106997.fctr..."
## [1] "Creating new feature: Q106272.fctr..."
## [1] "Creating new feature: Q106388.fctr..."
## [1] "Creating new feature: Q106389.fctr..."
## [1] "Creating new feature: Q106042.fctr..."
## [1] "Creating new feature: Q105840.fctr..."
## [1] "Creating new feature: Q105655.fctr..."
## [1] "Creating new feature: Q104996.fctr..."
## [1] "Creating new feature: Q103293.fctr..."
## [1] "Creating new feature: Q102906.fctr..."
## [1] "Creating new feature: Q102674.fctr..."
## [1] "Creating new feature: Q102687.fctr..."
## [1] "Creating new feature: Q102289.fctr..."
## [1] "Creating new feature: Q102089.fctr..."
## [1] "Creating new feature: Q101162.fctr..."
## [1] "Creating new feature: Q101163.fctr..."
## [1] "Creating new feature: Q101596.fctr..."
## [1] "Creating new feature: Q100689.fctr..."
## [1] "Creating new feature: Q100680.fctr..."
## [1] "Creating new feature: Q100562.fctr..."
## [1] "Creating new feature: Q100010.fctr..."
## [1] "Creating new feature: Q99982.fctr..."
## [1] "Creating new feature: Q99716.fctr..."
## [1] "Creating new feature: Q99581.fctr..."
## [1] "Creating new feature: Q99480.fctr..."
## [1] "Creating new feature: Q98869.fctr..."
## [1] "Creating new feature: Q98578.fctr..."
## [1] "Creating new feature: Q98197.fctr..."
## [1] "Creating new feature: Q98059.fctr..."
## [1] "Creating new feature: Q98078.fctr..."
## [1] "Creating new feature: Q96024.fctr..."
## [1] "Partition stats:"
## Loading required package: sqldf
## Loading required package: gsubfn
## Loading required package: proto
## Loading required package: RSQLite
## Loading required package: DBI
## Loading required package: tcltk
## Party .src .n
## 1 Democrat Train 2951
## 2 Republican Train 2617
## 3 <NA> Test 1392
## Party .src .n
## 1 Democrat Train 2951
## 2 Republican Train 2617
## 3 <NA> Test 1392
## Loading required package: RColorBrewer
## .src .n
## 1 Train 5568
## 2 Test 1392
## Loading required package: lazyeval
## Loading required package: gdata
## gdata: read.xls support for 'XLS' (Excel 97-2004) files ENABLED.
##
## gdata: read.xls support for 'XLSX' (Excel 2007+) files ENABLED.
##
## Attaching package: 'gdata'
## The following objects are masked from 'package:dplyr':
##
## combine, first, last
## The following object is masked from 'package:stats':
##
## nobs
## The following object is masked from 'package:utils':
##
## object.size
## [1] "Found 0 duplicates by all features:"
## NULL
## label step_major step_minor label_minor bgn end elapsed
## 1 import.data 1 0 0 11.959 25.772 13.813
## 2 inspect.data 2 0 0 25.772 NA NA
2.0: inspect data## Warning: Removed 1392 rows containing non-finite values (stat_count).
## Loading required package: reshape2
## Party.Democrat Party.Republican Party.NA
## Test NA NA 1392
## Train 2951 2617 NA
## Party.Democrat Party.Republican Party.NA
## Test NA NA 1
## Train 0.5299928 0.4700072 NA
## [1] "numeric data missing in glbObsAll: "
## YOB
## 415
## [1] "numeric data w/ 0s in glbObsAll: "
## YOB.Age.dff
## 438
## [1] "numeric data w/ Infs in glbObsAll: "
## named integer(0)
## [1] "numeric data w/ NaNs in glbObsAll: "
## named integer(0)
## [1] "string data missing in glbObsAll: "
## Gender Income HouseholdStatus EducationLevel
## 143 1273 552 1067
## Party Q124742 Q124122 Q123464
## NA 4340 3114 2912
## Q123621 Q122769 Q122770 Q122771
## 3018 2778 2597 2579
## Q122120 Q121699 Q121700 Q120978
## 2552 2279 2328 2303
## Q121011 Q120379 Q120650 Q120472
## 2256 2361 2283 2433
## Q120194 Q120012 Q120014 Q119334
## 2603 2344 2571 2477
## Q119851 Q119650 Q118892 Q118117
## 2243 2374 2206 2342
## Q118232 Q118233 Q118237 Q117186
## 3018 2659 2592 2845
## Q117193 Q116797 Q116881 Q116953
## 2799 2771 2889 2848
## Q116601 Q116441 Q116448 Q116197
## 2606 2684 2730 2657
## Q115602 Q115777 Q115610 Q115611
## 2619 2785 2637 2443
## Q115899 Q115390 Q114961 Q114748
## 2789 2860 2687 2462
## Q115195 Q114517 Q114386 Q113992
## 2647 2567 2686 2502
## Q114152 Q113583 Q113584 Q113181
## 2829 2632 2654 2576
## Q112478 Q112512 Q112270 Q111848
## 2790 2676 2820 2449
## Q111580 Q111220 Q110740 Q109367
## 2686 2563 2479 2624
## Q108950 Q109244 Q108855 Q108617
## 2641 2731 3008 2696
## Q108856 Q108754 Q108342 Q108343
## 3007 2770 2760 2736
## Q107869 Q107491 Q106993 Q106997
## 2762 2667 2676 2702
## Q106272 Q106388 Q106389 Q106042
## 2722 2818 2871 2762
## Q105840 Q105655 Q104996 Q103293
## 2876 2612 2620 2674
## Q102906 Q102674 Q102687 Q102289
## 2840 2864 2712 2790
## Q102089 Q101162 Q101163 Q101596
## 2736 2816 2995 2824
## Q100689 Q100680 Q100562 Q99982
## 2568 2787 2793 2871
## Q100010 Q99716 Q99581 Q99480
## 2688 2790 2690 2700
## Q98869 Q98578 Q98059 Q98078
## 2906 2867 2629 2945
## Q98197 Q96024
## 2836 2858
## Party Party.fctr .n
## 1 Democrat D 2951
## 2 Republican R 2617
## 3 <NA> <NA> 1392
## Warning: Removed 1 rows containing missing values (position_stack).
## Party.fctr.R Party.fctr.D Party.fctr.NA
## Test NA NA 1392
## Train 2617 2951 NA
## Party.fctr.R Party.fctr.D Party.fctr.NA
## Test NA NA 1
## Train 0.4700072 0.5299928 NA
## [1] "elapsed Time (secs): 8.930000"
## Loading required package: caTools
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## [1] "elapsed Time (secs): 161.851000"
## [1] "elapsed Time (secs): 161.851000"
## label step_major step_minor label_minor bgn end elapsed
## 2 inspect.data 2 0 0 25.772 199.224 173.453
## 3 scrub.data 2 1 1 199.225 NA NA
2.1: scrub data## [1] "numeric data missing in glbObsAll: "
## YOB Party.fctr
## 415 1392
## [1] "numeric data w/ 0s in glbObsAll: "
## YOB.Age.dff
## 438
## [1] "numeric data w/ Infs in glbObsAll: "
## named integer(0)
## [1] "numeric data w/ NaNs in glbObsAll: "
## named integer(0)
## [1] "string data missing in glbObsAll: "
## Gender Income HouseholdStatus EducationLevel
## 143 1273 552 1067
## Party Q124742 Q124122 Q123464
## NA 4340 3114 2912
## Q123621 Q122769 Q122770 Q122771
## 3018 2778 2597 2579
## Q122120 Q121699 Q121700 Q120978
## 2552 2279 2328 2303
## Q121011 Q120379 Q120650 Q120472
## 2256 2361 2283 2433
## Q120194 Q120012 Q120014 Q119334
## 2603 2344 2571 2477
## Q119851 Q119650 Q118892 Q118117
## 2243 2374 2206 2342
## Q118232 Q118233 Q118237 Q117186
## 3018 2659 2592 2845
## Q117193 Q116797 Q116881 Q116953
## 2799 2771 2889 2848
## Q116601 Q116441 Q116448 Q116197
## 2606 2684 2730 2657
## Q115602 Q115777 Q115610 Q115611
## 2619 2785 2637 2443
## Q115899 Q115390 Q114961 Q114748
## 2789 2860 2687 2462
## Q115195 Q114517 Q114386 Q113992
## 2647 2567 2686 2502
## Q114152 Q113583 Q113584 Q113181
## 2829 2632 2654 2576
## Q112478 Q112512 Q112270 Q111848
## 2790 2676 2820 2449
## Q111580 Q111220 Q110740 Q109367
## 2686 2563 2479 2624
## Q108950 Q109244 Q108855 Q108617
## 2641 2731 3008 2696
## Q108856 Q108754 Q108342 Q108343
## 3007 2770 2760 2736
## Q107869 Q107491 Q106993 Q106997
## 2762 2667 2676 2702
## Q106272 Q106388 Q106389 Q106042
## 2722 2818 2871 2762
## Q105840 Q105655 Q104996 Q103293
## 2876 2612 2620 2674
## Q102906 Q102674 Q102687 Q102289
## 2840 2864 2712 2790
## Q102089 Q101162 Q101163 Q101596
## 2736 2816 2995 2824
## Q100689 Q100680 Q100562 Q99982
## 2568 2787 2793 2871
## Q100010 Q99716 Q99581 Q99480
## 2688 2790 2690 2700
## Q98869 Q98578 Q98059 Q98078
## 2906 2867 2629 2945
## Q98197 Q96024
## 2836 2858
## label step_major step_minor label_minor bgn end elapsed
## 3 scrub.data 2 1 1 199.225 244.501 45.277
## 4 transform.data 2 2 2 244.502 NA NA
2.2: transform data## label step_major step_minor label_minor bgn end
## 4 transform.data 2 2 2 244.502 244.55
## 5 extract.features 3 0 0 244.550 NA
## elapsed
## 4 0.048
## 5 NA
3.0: extract features## label step_major step_minor label_minor bgn
## 5 extract.features 3 0 0 244.550
## 6 extract.features.datetime 3 1 1 244.575
## end elapsed
## 5 244.575 0.025
## 6 NA NA
3.1: extract features datetime## label step_major step_minor label_minor bgn
## 1 extract.features.datetime.bgn 1 0 0 244.605
## end elapsed
## 1 NA NA
## label step_major step_minor label_minor bgn
## 6 extract.features.datetime 3 1 1 244.575
## 7 extract.features.image 3 2 2 244.617
## end elapsed
## 6 244.616 0.042
## 7 NA NA
3.2: extract features image## label step_major step_minor label_minor bgn end
## 1 extract.features.image.bgn 1 0 0 244.655 NA
## elapsed
## 1 NA
## label step_major step_minor label_minor bgn
## 1 extract.features.image.bgn 1 0 0 244.655
## 2 extract.features.image.end 2 0 0 244.667
## end elapsed
## 1 244.666 0.011
## 2 NA NA
## label step_major step_minor label_minor bgn
## 1 extract.features.image.bgn 1 0 0 244.655
## 2 extract.features.image.end 2 0 0 244.667
## end elapsed
## 1 244.666 0.011
## 2 NA NA
## label step_major step_minor label_minor bgn end
## 7 extract.features.image 3 2 2 244.617 244.679
## 8 extract.features.price 3 3 3 244.680 NA
## elapsed
## 7 0.062
## 8 NA
3.3: extract features price## label step_major step_minor label_minor bgn end
## 1 extract.features.price.bgn 1 0 0 244.711 NA
## elapsed
## 1 NA
## label step_major step_minor label_minor bgn end
## 8 extract.features.price 3 3 3 244.680 244.721
## 9 extract.features.text 3 4 4 244.722 NA
## elapsed
## 8 0.041
## 9 NA
3.4: extract features text## label step_major step_minor label_minor bgn end
## 1 extract.features.text.bgn 1 0 0 244.774 NA
## elapsed
## 1 NA
## label step_major step_minor label_minor bgn
## 9 extract.features.text 3 4 4 244.722
## 10 extract.features.string 3 5 5 244.785
## end elapsed
## 9 244.784 0.062
## 10 NA NA
3.5: extract features string## label step_major step_minor label_minor bgn
## 1 extract.features.string.bgn 1 0 0 244.824
## end elapsed
## 1 NA NA
## label step_major step_minor
## 1 extract.features.string.bgn 1 0
## 2 extract.features.stringfactorize.str.vars 2 0
## label_minor bgn end elapsed
## 1 0 244.824 244.835 0.011
## 2 0 244.836 NA NA
## Gender Income HouseholdStatus EducationLevel
## "Gender" "Income" "HouseholdStatus" "EducationLevel"
## Party Q124742 Q124122 Q123464
## "Party" "Q124742" "Q124122" "Q123464"
## Q123621 Q122769 Q122770 Q122771
## "Q123621" "Q122769" "Q122770" "Q122771"
## Q122120 Q121699 Q121700 Q120978
## "Q122120" "Q121699" "Q121700" "Q120978"
## Q121011 Q120379 Q120650 Q120472
## "Q121011" "Q120379" "Q120650" "Q120472"
## Q120194 Q120012 Q120014 Q119334
## "Q120194" "Q120012" "Q120014" "Q119334"
## Q119851 Q119650 Q118892 Q118117
## "Q119851" "Q119650" "Q118892" "Q118117"
## Q118232 Q118233 Q118237 Q117186
## "Q118232" "Q118233" "Q118237" "Q117186"
## Q117193 Q116797 Q116881 Q116953
## "Q117193" "Q116797" "Q116881" "Q116953"
## Q116601 Q116441 Q116448 Q116197
## "Q116601" "Q116441" "Q116448" "Q116197"
## Q115602 Q115777 Q115610 Q115611
## "Q115602" "Q115777" "Q115610" "Q115611"
## Q115899 Q115390 Q114961 Q114748
## "Q115899" "Q115390" "Q114961" "Q114748"
## Q115195 Q114517 Q114386 Q113992
## "Q115195" "Q114517" "Q114386" "Q113992"
## Q114152 Q113583 Q113584 Q113181
## "Q114152" "Q113583" "Q113584" "Q113181"
## Q112478 Q112512 Q112270 Q111848
## "Q112478" "Q112512" "Q112270" "Q111848"
## Q111580 Q111220 Q110740 Q109367
## "Q111580" "Q111220" "Q110740" "Q109367"
## Q108950 Q109244 Q108855 Q108617
## "Q108950" "Q109244" "Q108855" "Q108617"
## Q108856 Q108754 Q108342 Q108343
## "Q108856" "Q108754" "Q108342" "Q108343"
## Q107869 Q107491 Q106993 Q106997
## "Q107869" "Q107491" "Q106993" "Q106997"
## Q106272 Q106388 Q106389 Q106042
## "Q106272" "Q106388" "Q106389" "Q106042"
## Q105840 Q105655 Q104996 Q103293
## "Q105840" "Q105655" "Q104996" "Q103293"
## Q102906 Q102674 Q102687 Q102289
## "Q102906" "Q102674" "Q102687" "Q102289"
## Q102089 Q101162 Q101163 Q101596
## "Q102089" "Q101162" "Q101163" "Q101596"
## Q100689 Q100680 Q100562 Q99982
## "Q100689" "Q100680" "Q100562" "Q99982"
## Q100010 Q99716 Q99581 Q99480
## "Q100010" "Q99716" "Q99581" "Q99480"
## Q98869 Q98578 Q98059 Q98078
## "Q98869" "Q98578" "Q98059" "Q98078"
## Q98197 Q96024 .src
## "Q98197" "Q96024" ".src"
## label step_major step_minor label_minor bgn
## 10 extract.features.string 3 5 5 244.785
## 11 extract.features.end 3 6 6 244.861
## end elapsed
## 10 244.86 0.076
## 11 NA NA
3.6: extract features end## time trans "bgn " "fit.data.training.all " "predict.data.new " "end "
## 0.0000 multiple enabled transitions: data.training.all data.new model.selected firing: data.training.all
## 1.0000 1 2 1 0 0
## 1.0000 multiple enabled transitions: data.training.all data.new model.selected model.final data.training.all.prediction firing: data.new
## 2.0000 2 1 1 1 0
## label step_major step_minor label_minor bgn end
## 11 extract.features.end 3 6 6 244.861 245.947
## 12 manage.missing.data 4 0 0 245.948 NA
## elapsed
## 11 1.086
## 12 NA
4.0: manage missing data## [1] "numeric data missing in glbObsAll: "
## YOB Party.fctr
## 415 1392
## [1] "numeric data w/ 0s in glbObsAll: "
## YOB.Age.dff
## 438
## [1] "numeric data w/ Infs in glbObsAll: "
## named integer(0)
## [1] "numeric data w/ NaNs in glbObsAll: "
## named integer(0)
## [1] "string data missing in glbObsAll: "
## Gender Income HouseholdStatus EducationLevel
## 143 1273 552 1067
## Party Q124742 Q124122 Q123464
## NA 4340 3114 2912
## Q123621 Q122769 Q122770 Q122771
## 3018 2778 2597 2579
## Q122120 Q121699 Q121700 Q120978
## 2552 2279 2328 2303
## Q121011 Q120379 Q120650 Q120472
## 2256 2361 2283 2433
## Q120194 Q120012 Q120014 Q119334
## 2603 2344 2571 2477
## Q119851 Q119650 Q118892 Q118117
## 2243 2374 2206 2342
## Q118232 Q118233 Q118237 Q117186
## 3018 2659 2592 2845
## Q117193 Q116797 Q116881 Q116953
## 2799 2771 2889 2848
## Q116601 Q116441 Q116448 Q116197
## 2606 2684 2730 2657
## Q115602 Q115777 Q115610 Q115611
## 2619 2785 2637 2443
## Q115899 Q115390 Q114961 Q114748
## 2789 2860 2687 2462
## Q115195 Q114517 Q114386 Q113992
## 2647 2567 2686 2502
## Q114152 Q113583 Q113584 Q113181
## 2829 2632 2654 2576
## Q112478 Q112512 Q112270 Q111848
## 2790 2676 2820 2449
## Q111580 Q111220 Q110740 Q109367
## 2686 2563 2479 2624
## Q108950 Q109244 Q108855 Q108617
## 2641 2731 3008 2696
## Q108856 Q108754 Q108342 Q108343
## 3007 2770 2760 2736
## Q107869 Q107491 Q106993 Q106997
## 2762 2667 2676 2702
## Q106272 Q106388 Q106389 Q106042
## 2722 2818 2871 2762
## Q105840 Q105655 Q104996 Q103293
## 2876 2612 2620 2674
## Q102906 Q102674 Q102687 Q102289
## 2840 2864 2712 2790
## Q102089 Q101162 Q101163 Q101596
## 2736 2816 2995 2824
## Q100689 Q100680 Q100562 Q99982
## 2568 2787 2793 2871
## Q100010 Q99716 Q99581 Q99480
## 2688 2790 2690 2700
## Q98869 Q98578 Q98059 Q98078
## 2906 2867 2629 2945
## Q98197 Q96024
## 2836 2858
## [1] "numeric data missing in glbObsAll: "
## YOB Party.fctr
## 415 1392
## [1] "numeric data w/ 0s in glbObsAll: "
## YOB.Age.dff
## 438
## [1] "numeric data w/ Infs in glbObsAll: "
## named integer(0)
## [1] "numeric data w/ NaNs in glbObsAll: "
## named integer(0)
## [1] "string data missing in glbObsAll: "
## Gender Income HouseholdStatus EducationLevel
## 143 1273 552 1067
## Party Q124742 Q124122 Q123464
## NA 4340 3114 2912
## Q123621 Q122769 Q122770 Q122771
## 3018 2778 2597 2579
## Q122120 Q121699 Q121700 Q120978
## 2552 2279 2328 2303
## Q121011 Q120379 Q120650 Q120472
## 2256 2361 2283 2433
## Q120194 Q120012 Q120014 Q119334
## 2603 2344 2571 2477
## Q119851 Q119650 Q118892 Q118117
## 2243 2374 2206 2342
## Q118232 Q118233 Q118237 Q117186
## 3018 2659 2592 2845
## Q117193 Q116797 Q116881 Q116953
## 2799 2771 2889 2848
## Q116601 Q116441 Q116448 Q116197
## 2606 2684 2730 2657
## Q115602 Q115777 Q115610 Q115611
## 2619 2785 2637 2443
## Q115899 Q115390 Q114961 Q114748
## 2789 2860 2687 2462
## Q115195 Q114517 Q114386 Q113992
## 2647 2567 2686 2502
## Q114152 Q113583 Q113584 Q113181
## 2829 2632 2654 2576
## Q112478 Q112512 Q112270 Q111848
## 2790 2676 2820 2449
## Q111580 Q111220 Q110740 Q109367
## 2686 2563 2479 2624
## Q108950 Q109244 Q108855 Q108617
## 2641 2731 3008 2696
## Q108856 Q108754 Q108342 Q108343
## 3007 2770 2760 2736
## Q107869 Q107491 Q106993 Q106997
## 2762 2667 2676 2702
## Q106272 Q106388 Q106389 Q106042
## 2722 2818 2871 2762
## Q105840 Q105655 Q104996 Q103293
## 2876 2612 2620 2674
## Q102906 Q102674 Q102687 Q102289
## 2840 2864 2712 2790
## Q102089 Q101162 Q101163 Q101596
## 2736 2816 2995 2824
## Q100689 Q100680 Q100562 Q99982
## 2568 2787 2793 2871
## Q100010 Q99716 Q99581 Q99480
## 2688 2790 2690 2700
## Q98869 Q98578 Q98059 Q98078
## 2906 2867 2629 2945
## Q98197 Q96024
## 2836 2858
## label step_major step_minor label_minor bgn end
## 12 manage.missing.data 4 0 0 245.948 246.897
## 13 cluster.data 5 0 0 246.897 NA
## elapsed
## 12 0.949
## 13 NA
5.0: cluster data{r cluster.data, cache=FALSE, echo=FALSE, eval=myevlChunk(glbChunks, glbOut$pfx)} #{r cluster.data, cache=FALSE, echo=FALSE, eval=myevlChunk(glbChunks, glbOut$pfx, keep = c(“glbFeatsCategory”,“glb_dsp_cols”))}## Loading required package: proxy
##
## Attaching package: 'proxy'
## The following objects are masked from 'package:stats':
##
## as.dist, dist
## The following object is masked from 'package:base':
##
## as.matrix
## Loading required package: dynamicTreeCut
## Loading required package: entropy
## Loading required package: tidyr
## Loading required package: ggdendro
## [1] "Clustering features: "
## abs.cor.y
## Q120472.fctr 0.04620307
## Q98197.fctr 0.05493425
## Q113181.fctr 0.08087531
## Q115611.fctr 0.09044682
## Q109244.fctr 0.12038125
## [1] " .rnorm cor: -0.0078"
## [1] " Clustering entropy measure: Party.fctr"
## [1] "glbObsAll Entropy: 0.6913"
## Q109244.fctr .clusterid Q109244.fctr.clusterid R D .entropy .knt
## 1 NA 1 NA_1 1013 1171 0.6905280 2184
## 2 No 1 No_1 1421 1038 0.6809679 2459
## 3 Yes 1 Yes_1 183 742 0.4973904 925
## [1] "glbObsAll$Q109244.fctr Entropy: 0.6542 (94.6298 pct)"
## [1] "Category: NA"
## [1] "max distance(0.9789) pair:"
## USER_ID Party.fctr Q109244.fctr Q124742.fctr Q124122.fctr
## 6014 2335 <NA> NA NA NA
## 6776 6059 <NA> NA NA No
## Q123621.fctr Q123464.fctr Q122771.fctr Q122770.fctr Q122769.fctr
## 6014 NA NA NA NA NA
## 6776 No No Pc Yes Yes
## Q122120.fctr Q121700.fctr Q121699.fctr Q121011.fctr Q120978.fctr
## 6014 NA NA NA NA NA
## 6776 Yes Yes No Yes No
## Q120650.fctr Q120472.fctr Q120379.fctr Q120194.fctr Q120014.fctr
## 6014 NA NA NA NA NA
## 6776 Yes Science Yes Try first Yes
## Q120012.fctr Q119851.fctr Q119650.fctr Q119334.fctr Q118892.fctr
## 6014 NA NA NA NA NA
## 6776 Yes No Giving Yes Yes
## Q118237.fctr Q118233.fctr Q118232.fctr Q118117.fctr Q117193.fctr
## 6014 NA NA NA NA NA
## 6776 Yes No Id No Standard hours
## Q117186.fctr Q116797.fctr Q116881.fctr Q116953.fctr Q116601.fctr
## 6014 NA NA NA NA NA
## 6776 Cool headed NA Happy Yes NA
## Q116441.fctr Q116448.fctr Q116197.fctr Q115602.fctr Q115777.fctr
## 6014 NA NA P.M. NA NA
## 6776 NA NA NA NA NA
## Q115610.fctr Q115611.fctr Q115899.fctr Q115390.fctr Q115195.fctr
## 6014 NA NA NA NA NA
## 6776 NA NA NA NA NA
## Q114961.fctr Q114748.fctr Q114517.fctr Q114386.fctr Q114152.fctr
## 6014 NA NA NA NA NA
## 6776 NA Yes Yes NA NA
## Q113992.fctr Q113583.fctr Q113584.fctr Q113181.fctr Q112478.fctr
## 6014 NA NA NA NA Yes
## 6776 NA Tunes NA NA NA
## Q112512.fctr Q112270.fctr Q111848.fctr Q111580.fctr Q111220.fctr
## 6014 Yes No Yes Supportive No
## 6776 NA NA NA NA NA
## Q110740.fctr Q109367.fctr Q109244.fctr.1 Q108950.fctr Q108855.fctr
## 6014 PC NA NA Cautious Umm...
## 6776 NA NA NA NA NA
## Q108617.fctr Q108856.fctr Q108754.fctr Q108342.fctr Q108343.fctr
## 6014 No Space No Online Yes
## 6776 NA NA NA NA NA
## Q107869.fctr Q107491.fctr Q106993.fctr Q106997.fctr Q106272.fctr
## 6014 No Yes Yes Yy Yes
## 6776 NA NA NA NA NA
## Q106388.fctr Q106389.fctr Q106042.fctr Q105840.fctr Q105655.fctr
## 6014 No No Yes No Yes
## 6776 NA NA NA NA NA
## Q104996.fctr Q103293.fctr Q102906.fctr Q102674.fctr Q102687.fctr
## 6014 No Yes No No Yes
## 6776 NA NA NA NA No
## Q102289.fctr Q102089.fctr Q101162.fctr Q101163.fctr Q101596.fctr
## 6014 No Own Pessimist Dad Yes
## 6776 NA NA NA NA NA
## Q100689.fctr Q100680.fctr Q100562.fctr Q100010.fctr Q99982.fctr
## 6014 Yes Yes No Yes Nope
## 6776 NA NA NA NA NA
## Q99716.fctr Q99581.fctr Q99480.fctr Q98869.fctr Q98578.fctr
## 6014 No No Yes NA NA
## 6776 NA NA NA NA NA
## Q98197.fctr Q98059.fctr Q98078.fctr Q96024.fctr
## 6014 NA NA NA Yes
## 6776 NA NA NA NA
## [1] "min distance(0.9475) pair:"
## USER_ID Party.fctr Q109244.fctr Q124742.fctr Q124122.fctr
## 4693 5857 D NA NA NA
## 5108 6377 R NA NA NA
## Q123621.fctr Q123464.fctr Q122771.fctr Q122770.fctr Q122769.fctr
## 4693 NA NA NA NA NA
## 5108 NA NA NA NA NA
## Q122120.fctr Q121700.fctr Q121699.fctr Q121011.fctr Q120978.fctr
## 4693 NA NA NA NA NA
## 5108 NA NA NA NA NA
## Q120650.fctr Q120472.fctr Q120379.fctr Q120194.fctr Q120014.fctr
## 4693 NA NA NA NA NA
## 5108 NA NA NA NA NA
## Q120012.fctr Q119851.fctr Q119650.fctr Q119334.fctr Q118892.fctr
## 4693 NA NA NA NA NA
## 5108 NA NA NA NA NA
## Q118237.fctr Q118233.fctr Q118232.fctr Q118117.fctr Q117193.fctr
## 4693 NA NA NA NA NA
## 5108 NA NA NA NA NA
## Q117186.fctr Q116797.fctr Q116881.fctr Q116953.fctr Q116601.fctr
## 4693 NA NA NA NA NA
## 5108 NA NA NA NA NA
## Q116441.fctr Q116448.fctr Q116197.fctr Q115602.fctr Q115777.fctr
## 4693 NA NA NA Yes NA
## 5108 NA NA NA NA NA
## Q115610.fctr Q115611.fctr Q115899.fctr Q115390.fctr Q115195.fctr
## 4693 Yes Yes NA Yes Yes
## 5108 NA Yes NA Yes No
## Q114961.fctr Q114748.fctr Q114517.fctr Q114386.fctr Q114152.fctr
## 4693 Yes Yes No NA NA
## 5108 Yes Yes No NA NA
## Q113992.fctr Q113583.fctr Q113584.fctr Q113181.fctr Q112478.fctr
## 4693 Yes NA People Yes NA
## 5108 NA Tunes NA Yes NA
## Q112512.fctr Q112270.fctr Q111848.fctr Q111580.fctr Q111220.fctr
## 4693 NA NA NA NA NA
## 5108 NA NA NA NA NA
## Q110740.fctr Q109367.fctr Q109244.fctr.1 Q108950.fctr Q108855.fctr
## 4693 NA NA NA NA NA
## 5108 NA NA NA NA NA
## Q108617.fctr Q108856.fctr Q108754.fctr Q108342.fctr Q108343.fctr
## 4693 NA NA NA NA NA
## 5108 NA NA NA NA NA
## Q107869.fctr Q107491.fctr Q106993.fctr Q106997.fctr Q106272.fctr
## 4693 NA NA NA NA NA
## 5108 NA NA NA NA NA
## Q106388.fctr Q106389.fctr Q106042.fctr Q105840.fctr Q105655.fctr
## 4693 NA NA NA NA NA
## 5108 NA NA NA NA NA
## Q104996.fctr Q103293.fctr Q102906.fctr Q102674.fctr Q102687.fctr
## 4693 NA NA NA NA NA
## 5108 NA NA NA NA NA
## Q102289.fctr Q102089.fctr Q101162.fctr Q101163.fctr Q101596.fctr
## 4693 NA NA NA NA NA
## 5108 NA NA NA NA NA
## Q100689.fctr Q100680.fctr Q100562.fctr Q100010.fctr Q99982.fctr
## 4693 NA NA NA NA NA
## 5108 NA NA NA NA NA
## Q99716.fctr Q99581.fctr Q99480.fctr Q98869.fctr Q98578.fctr
## 4693 NA NA NA NA NA
## 5108 NA NA NA NA NA
## Q98197.fctr Q98059.fctr Q98078.fctr Q96024.fctr
## 4693 NA NA NA NA
## 5108 NA NA NA NA
## [1] "Category: No"
## [1] "max distance(0.9739) pair:"
## USER_ID Party.fctr Q109244.fctr Q124742.fctr Q124122.fctr
## 2961 3680 R No NA NA
## 4750 5926 R No NA NA
## Q123621.fctr Q123464.fctr Q122771.fctr Q122770.fctr Q122769.fctr
## 2961 Yes No Pt Yes No
## 4750 NA NA NA NA NA
## Q122120.fctr Q121700.fctr Q121699.fctr Q121011.fctr Q120978.fctr
## 2961 No No Yes Yes Yes
## 4750 NA NA NA NA NA
## Q120650.fctr Q120472.fctr Q120379.fctr Q120194.fctr Q120014.fctr
## 2961 Yes Science Yes NA Yes
## 4750 NA NA NA NA NA
## Q120012.fctr Q119851.fctr Q119650.fctr Q119334.fctr Q118892.fctr
## 2961 Yes No Giving No Yes
## 4750 NA NA NA NA NA
## Q118237.fctr Q118233.fctr Q118232.fctr Q118117.fctr Q117193.fctr
## 2961 Yes No Pr No Standard hours
## 4750 Yes Yes Pr Yes NA
## Q117186.fctr Q116797.fctr Q116881.fctr Q116953.fctr Q116601.fctr
## 2961 Hot headed NA NA NA NA
## 4750 NA NA NA NA Yes
## Q116441.fctr Q116448.fctr Q116197.fctr Q115602.fctr Q115777.fctr
## 2961 NA NA NA NA Start
## 4750 Yes No NA NA NA
## Q115610.fctr Q115611.fctr Q115899.fctr Q115390.fctr Q115195.fctr
## 2961 NA NA NA NA NA
## 4750 NA NA NA NA Yes
## Q114961.fctr Q114748.fctr Q114517.fctr Q114386.fctr Q114152.fctr
## 2961 NA NA NA NA NA
## 4750 Yes Yes Yes Mysterious NA
## Q113992.fctr Q113583.fctr Q113584.fctr Q113181.fctr Q112478.fctr
## 2961 NA NA NA NA NA
## 4750 No Tunes Technology NA No
## Q112512.fctr Q112270.fctr Q111848.fctr Q111580.fctr Q111220.fctr
## 2961 NA NA NA NA NA
## 4750 NA No Yes Supportive No
## Q110740.fctr Q109367.fctr Q109244.fctr.1 Q108950.fctr Q108855.fctr
## 2961 NA No No Cautious Umm...
## 4750 PC Yes No Cautious Umm...
## Q108617.fctr Q108856.fctr Q108754.fctr Q108342.fctr Q108343.fctr
## 2961 No Space Yes Online No
## 4750 No Space No In-person No
## Q107869.fctr Q107491.fctr Q106993.fctr Q106997.fctr Q106272.fctr
## 2961 No Yes Yes Gr NA
## 4750 NA No No Gr Yes
## Q106388.fctr Q106389.fctr Q106042.fctr Q105840.fctr Q105655.fctr
## 2961 NA NA NA NA NA
## 4750 Yes Yes No No Yes
## Q104996.fctr Q103293.fctr Q102906.fctr Q102674.fctr Q102687.fctr
## 2961 NA NA NA NA NA
## 4750 Yes No No Yes Yes
## Q102289.fctr Q102089.fctr Q101162.fctr Q101163.fctr Q101596.fctr
## 2961 NA NA NA NA NA
## 4750 Yes Own Optimist Dad Yes
## Q100689.fctr Q100680.fctr Q100562.fctr Q100010.fctr Q99982.fctr
## 2961 NA NA NA NA NA
## 4750 No Yes Yes Yes Nope
## Q99716.fctr Q99581.fctr Q99480.fctr Q98869.fctr Q98578.fctr
## 2961 NA NA NA NA NA
## 4750 No No Yes Yes Yes
## Q98197.fctr Q98059.fctr Q98078.fctr Q96024.fctr
## 2961 NA NA NA NA
## 4750 Yes Yes Yes No
## [1] "min distance(0.9490) pair:"
## USER_ID Party.fctr Q109244.fctr Q124742.fctr Q124122.fctr
## 1423 1771 D No NA NA
## 4299 5365 R No NA NA
## Q123621.fctr Q123464.fctr Q122771.fctr Q122770.fctr Q122769.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q122120.fctr Q121700.fctr Q121699.fctr Q121011.fctr Q120978.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q120650.fctr Q120472.fctr Q120379.fctr Q120194.fctr Q120014.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q120012.fctr Q119851.fctr Q119650.fctr Q119334.fctr Q118892.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q118237.fctr Q118233.fctr Q118232.fctr Q118117.fctr Q117193.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q117186.fctr Q116797.fctr Q116881.fctr Q116953.fctr Q116601.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q116441.fctr Q116448.fctr Q116197.fctr Q115602.fctr Q115777.fctr
## 1423 NA NA NA Yes Start
## 4299 NA NA NA Yes NA
## Q115610.fctr Q115611.fctr Q115899.fctr Q115390.fctr Q115195.fctr
## 1423 Yes No Cs Yes Yes
## 4299 Yes Yes NA Yes Yes
## Q114961.fctr Q114748.fctr Q114517.fctr Q114386.fctr Q114152.fctr
## 1423 No Yes No TMI NA
## 4299 No No Yes Mysterious Yes
## Q113992.fctr Q113583.fctr Q113584.fctr Q113181.fctr Q112478.fctr
## 1423 Yes NA NA Yes Yes
## 4299 No Talk People Yes NA
## Q112512.fctr Q112270.fctr Q111848.fctr Q111580.fctr Q111220.fctr
## 1423 NA No Yes Supportive NA
## 4299 NA NA NA NA NA
## Q110740.fctr Q109367.fctr Q109244.fctr.1 Q108950.fctr Q108855.fctr
## 1423 NA Yes No NA NA
## 4299 NA Yes No NA NA
## Q108617.fctr Q108856.fctr Q108754.fctr Q108342.fctr Q108343.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q107869.fctr Q107491.fctr Q106993.fctr Q106997.fctr Q106272.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q106388.fctr Q106389.fctr Q106042.fctr Q105840.fctr Q105655.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q104996.fctr Q103293.fctr Q102906.fctr Q102674.fctr Q102687.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q102289.fctr Q102089.fctr Q101162.fctr Q101163.fctr Q101596.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q100689.fctr Q100680.fctr Q100562.fctr Q100010.fctr Q99982.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q99716.fctr Q99581.fctr Q99480.fctr Q98869.fctr Q98578.fctr
## 1423 NA NA NA NA NA
## 4299 NA NA NA NA NA
## Q98197.fctr Q98059.fctr Q98078.fctr Q96024.fctr
## 1423 NA NA NA NA
## 4299 NA NA NA NA
## [1] "Category: Yes"
## [1] "max distance(0.9671) pair:"
## USER_ID Party.fctr Q109244.fctr Q124742.fctr Q124122.fctr
## 1238 1532 R Yes Yes No
## 4262 5314 D Yes NA No
## Q123621.fctr Q123464.fctr Q122771.fctr Q122770.fctr Q122769.fctr
## 1238 Yes No Pc No No
## 4262 No No Pc Yes No
## Q122120.fctr Q121700.fctr Q121699.fctr Q121011.fctr Q120978.fctr
## 1238 No Yes Yes Yes Yes
## 4262 Yes Yes Yes No Yes
## Q120650.fctr Q120472.fctr Q120379.fctr Q120194.fctr Q120014.fctr
## 1238 Yes Art No Try first Yes
## 4262 Yes Art No Study first Yes
## Q120012.fctr Q119851.fctr Q119650.fctr Q119334.fctr Q118892.fctr
## 1238 Yes Yes Receiving No No
## 4262 Yes Yes Receiving Yes Yes
## Q118237.fctr Q118233.fctr Q118232.fctr Q118117.fctr Q117193.fctr
## 1238 Yes Yes Pr No Standard hours
## 4262 Yes No Id Yes Standard hours
## Q117186.fctr Q116797.fctr Q116881.fctr Q116953.fctr Q116601.fctr
## 1238 Cool headed Yes Right No Yes
## 4262 Hot headed Yes Happy Yes Yes
## Q116441.fctr Q116448.fctr Q116197.fctr Q115602.fctr Q115777.fctr
## 1238 Yes Yes NA NA NA
## 4262 No No P.M. Yes End
## Q115610.fctr Q115611.fctr Q115899.fctr Q115390.fctr Q115195.fctr
## 1238 NA NA NA Yes NA
## 4262 Yes No Me No No
## Q114961.fctr Q114748.fctr Q114517.fctr Q114386.fctr Q114152.fctr
## 1238 NA Yes No NA No
## 4262 Yes No No TMI No
## Q113992.fctr Q113583.fctr Q113584.fctr Q113181.fctr Q112478.fctr
## 1238 No Tunes Technology NA No
## 4262 No Tunes People No Yes
## Q112512.fctr Q112270.fctr Q111848.fctr Q111580.fctr Q111220.fctr
## 1238 Yes No NA Demanding No
## 4262 Yes No Yes Supportive NA
## Q110740.fctr Q109367.fctr Q109244.fctr.1 Q108950.fctr Q108855.fctr
## 1238 Mac Yes Yes Risk-friendly Umm...
## 4262 NA No Yes Cautious Yes!
## Q108617.fctr Q108856.fctr Q108754.fctr Q108342.fctr Q108343.fctr
## 1238 Yes Space No Online Yes
## 4262 No Space Yes Online No
## Q107869.fctr Q107491.fctr Q106993.fctr Q106997.fctr Q106272.fctr
## 1238 No Yes Yes Gr Yes
## 4262 Yes Yes Yes Gr NA
## Q106388.fctr Q106389.fctr Q106042.fctr Q105840.fctr Q105655.fctr
## 1238 No Yes Yes NA NA
## 4262 No Yes Yes NA No
## Q104996.fctr Q103293.fctr Q102906.fctr Q102674.fctr Q102687.fctr
## 1238 No NA Yes NA NA
## 4262 Yes Yes Yes No Yes
## Q102289.fctr Q102089.fctr Q101162.fctr Q101163.fctr Q101596.fctr
## 1238 Yes Rent Pessimist Dad Yes
## 4262 No Own Pessimist NA NA
## Q100689.fctr Q100680.fctr Q100562.fctr Q100010.fctr Q99982.fctr
## 1238 Yes Yes Yes Yes Check!
## 4262 No Yes Yes Yes Nope
## Q99716.fctr Q99581.fctr Q99480.fctr Q98869.fctr Q98578.fctr
## 1238 Yes No Yes Yes No
## 4262 No No No NA NA
## Q98197.fctr Q98059.fctr Q98078.fctr Q96024.fctr
## 1238 No Yes Yes No
## 4262 NA NA NA No
## [1] "min distance(0.9348) pair:"
## USER_ID Party.fctr Q109244.fctr Q124742.fctr Q124122.fctr
## 2712 3375 D Yes NA NA
## 3363 4185 D Yes NA NA
## Q123621.fctr Q123464.fctr Q122771.fctr Q122770.fctr Q122769.fctr
## 2712 NA NA NA NA NA
## 3363 NA NA NA NA NA
## Q122120.fctr Q121700.fctr Q121699.fctr Q121011.fctr Q120978.fctr
## 2712 NA NA NA NA NA
## 3363 NA NA NA NA NA
## Q120650.fctr Q120472.fctr Q120379.fctr Q120194.fctr Q120014.fctr
## 2712 NA NA NA NA NA
## 3363 NA NA NA NA NA
## Q120012.fctr Q119851.fctr Q119650.fctr Q119334.fctr Q118892.fctr
## 2712 NA NA NA NA NA
## 3363 NA NA NA NA NA
## Q118237.fctr Q118233.fctr Q118232.fctr Q118117.fctr Q117193.fctr
## 2712 NA NA NA NA NA
## 3363 NA NA NA NA NA
## Q117186.fctr Q116797.fctr Q116881.fctr Q116953.fctr Q116601.fctr
## 2712 NA NA NA NA NA
## 3363 NA NA NA NA NA
## Q116441.fctr Q116448.fctr Q116197.fctr Q115602.fctr Q115777.fctr
## 2712 NA NA NA NA NA
## 3363 NA NA NA NA NA
## Q115610.fctr Q115611.fctr Q115899.fctr Q115390.fctr Q115195.fctr
## 2712 NA NA NA NA NA
## 3363 NA NA NA NA NA
## Q114961.fctr Q114748.fctr Q114517.fctr Q114386.fctr Q114152.fctr
## 2712 NA NA NA NA NA
## 3363 NA NA NA NA NA
## Q113992.fctr Q113583.fctr Q113584.fctr Q113181.fctr Q112478.fctr
## 2712 NA NA NA NA NA
## 3363 NA NA NA NA NA
## Q112512.fctr Q112270.fctr Q111848.fctr Q111580.fctr Q111220.fctr
## 2712 NA NA NA NA NA
## 3363 NA NA NA NA NA
## Q110740.fctr Q109367.fctr Q109244.fctr.1 Q108950.fctr Q108855.fctr
## 2712 NA No Yes Cautious NA
## 3363 NA NA Yes NA NA
## Q108617.fctr Q108856.fctr Q108754.fctr Q108342.fctr Q108343.fctr
## 2712 NA NA No NA NA
## 3363 NA NA NA NA NA
## Q107869.fctr Q107491.fctr Q106993.fctr Q106997.fctr Q106272.fctr
## 2712 NA NA NA NA NA
## 3363 NA NA NA NA NA
## Q106388.fctr Q106389.fctr Q106042.fctr Q105840.fctr Q105655.fctr
## 2712 NA NA NA NA NA
## 3363 NA NA NA NA NA
## Q104996.fctr Q103293.fctr Q102906.fctr Q102674.fctr Q102687.fctr
## 2712 NA NA NA NA NA
## 3363 NA NA NA NA NA
## Q102289.fctr Q102089.fctr Q101162.fctr Q101163.fctr Q101596.fctr
## 2712 NA NA NA NA NA
## 3363 NA NA NA NA NA
## Q100689.fctr Q100680.fctr Q100562.fctr Q100010.fctr Q99982.fctr
## 2712 NA NA NA NA NA
## 3363 NA NA NA NA NA
## Q99716.fctr Q99581.fctr Q99480.fctr Q98869.fctr Q98578.fctr
## 2712 NA NA NA NA NA
## 3363 NA NA NA NA NA
## Q98197.fctr Q98059.fctr Q98078.fctr Q96024.fctr
## 2712 NA NA NA NA
## 3363 NA NA NA NA
## Q109244.fctr .clusterid Q109244.fctr.clusterid R D .entropy .knt
## 1 NA 1 NA_1 440 544 0.6875514 984
## 2 NA 2 NA_2 350 380 0.6923025 730
## 3 NA 3 NA_3 223 247 0.6918429 470
## 4 No 1 No_1 757 442 0.6582282 1199
## 5 No 2 No_2 300 343 0.6909094 643
## 6 No 3 No_3 364 253 0.6768762 617
## 7 Yes 1 Yes_1 104 416 0.5004024 520
## 8 Yes 2 Yes_2 49 177 0.5228461 226
## 9 Yes 3 Yes_3 30 149 0.4520566 179
## [1] "glbObsAll$Q109244.fctr$.clusterid Entropy: 0.6497 (99.3080 pct)"
## label step_major step_minor label_minor bgn
## 13 cluster.data 5 0 0 246.897
## 14 partition.data.training 6 0 0 408.645
## end elapsed
## 13 408.644 161.748
## 14 NA NA
6.0: partition data training## [1] "partition.data.training chunk: setup: elapsed: 0.00 secs"
## [1] "partition.data.training chunk: strata_mtrx complete: elapsed: 0.16 secs"
## [1] "partition.data.training chunk: obs_freq_df complete: elapsed: 0.16 secs"
## Loading required package: sampling
##
## Attaching package: 'sampling'
## The following object is masked from 'package:caret':
##
## cluster
## [1] "lclgetMatrixCorrelation: duration: 48.891000 secs"
## [1] "cor of Fit vs. OOB: 1.0000"
## [1] "lclgetMatrixCorrelation: duration: 17.364000 secs"
## [1] "cor of New vs. OOB: 1.0000"
## [1] "lclgetMatrixCorrelation: duration: 59.236000 secs"
## [1] "cor of Fit vs. New: 1.0000"
## [1] "partition.data.training chunk: Fit/OOB partition complete: elapsed: 126.35 secs"
## Party.Democrat Party.Republican Party.NA
## NA NA 1392
## Fit 2360 2093 NA
## OOB 591 524 NA
## Party.Democrat Party.Republican Party.NA
## NA NA 1
## Fit 0.5299798 0.4700202 NA
## OOB 0.5300448 0.4699552 NA
## Q109244.fctr .n.Fit .n.OOB .n.Tst .freqRatio.Fit .freqRatio.OOB
## 2 No 1961 498 622 0.4403773 0.4466368
## 1 NA 1746 438 547 0.3920952 0.3928251
## 3 Yes 746 179 223 0.1675275 0.1605381
## .freqRatio.Tst
## 2 0.4468391
## 1 0.3929598
## 3 0.1602011
## [1] "glbObsAll: "
## [1] 6960 222
## [1] "glbObsTrn: "
## [1] 5568 222
## [1] "glbObsFit: "
## [1] 4453 221
## [1] "glbObsOOB: "
## [1] 1115 221
## [1] "glbObsNew: "
## [1] 1392 221
## [1] "partition.data.training chunk: teardown: elapsed: 127.37 secs"
## label step_major step_minor label_minor bgn
## 14 partition.data.training 6 0 0 408.645
## 15 select.features 7 0 0 536.122
## end elapsed
## 14 536.122 127.477
## 15 NA NA
7.0: select features## [1] "cor(Q98059.fctr, Q98078.fctr)=0.7689"
## [1] "cor(Party.fctr, Q98059.fctr)=0.0172"
## [1] "cor(Party.fctr, Q98078.fctr)=0.0257"
## Warning in myfind_cor_features(feats_df = glb_feats_df, obs_df =
## glbObsTrn, : Identified Q98059.fctr as highly correlated with Q98078.fctr
## [1] "cor(Q99480.fctr, Q99581.fctr)=0.7660"
## [1] "cor(Party.fctr, Q99480.fctr)=-0.0344"
## [1] "cor(Party.fctr, Q99581.fctr)=-0.0104"
## Warning in myfind_cor_features(feats_df = glb_feats_df, obs_df =
## glbObsTrn, : Identified Q99581.fctr as highly correlated with Q99480.fctr
## [1] "cor(Q108855.fctr, Q108856.fctr)=0.7430"
## [1] "cor(Party.fctr, Q108855.fctr)=-0.0371"
## [1] "cor(Party.fctr, Q108856.fctr)=-0.0140"
## Warning in myfind_cor_features(feats_df = glb_feats_df, obs_df =
## glbObsTrn, : Identified Q108856.fctr as highly correlated with Q108855.fctr
## [1] "cor(Q122770.fctr, Q122771.fctr)=0.7379"
## [1] "cor(Party.fctr, Q122770.fctr)=-0.0195"
## [1] "cor(Party.fctr, Q122771.fctr)=-0.0348"
## Warning in myfind_cor_features(feats_df = glb_feats_df, obs_df =
## glbObsTrn, : Identified Q122770.fctr as highly correlated with Q122771.fctr
## [1] "cor(Q106272.fctr, Q106388.fctr)=0.7339"
## [1] "cor(Party.fctr, Q106272.fctr)=-0.0401"
## [1] "cor(Party.fctr, Q106388.fctr)=-0.0342"
## Warning in myfind_cor_features(feats_df = glb_feats_df, obs_df =
## glbObsTrn, : Identified Q106388.fctr as highly correlated with Q106272.fctr
## [1] "cor(Q100680.fctr, Q100689.fctr)=0.7292"
## [1] "cor(Party.fctr, Q100680.fctr)=0.0158"
## [1] "cor(Party.fctr, Q100689.fctr)=0.0257"
## Warning in myfind_cor_features(feats_df = glb_feats_df, obs_df =
## glbObsTrn, : Identified Q100680.fctr as highly correlated with Q100689.fctr
## [1] "cor(Q99480.fctr, Q99716.fctr)=0.7252"
## [1] "cor(Party.fctr, Q99480.fctr)=-0.0344"
## [1] "cor(Party.fctr, Q99716.fctr)=0.0209"
## Warning in myfind_cor_features(feats_df = glb_feats_df, obs_df =
## glbObsTrn, : Identified Q99716.fctr as highly correlated with Q99480.fctr
## [1] "cor(Q120472.fctr, Q120650.fctr)=0.7126"
## [1] "cor(Party.fctr, Q120472.fctr)=-0.0462"
## [1] "cor(Party.fctr, Q120650.fctr)=-0.0271"
## Warning in myfind_cor_features(feats_df = glb_feats_df, obs_df =
## glbObsTrn, : Identified Q120650.fctr as highly correlated with Q120472.fctr
## [1] "cor(Q98869.fctr, Q99480.fctr)=0.7084"
## [1] "cor(Party.fctr, Q98869.fctr)=-0.0277"
## [1] "cor(Party.fctr, Q99480.fctr)=-0.0344"
## Warning in myfind_cor_features(feats_df = glb_feats_df, obs_df =
## glbObsTrn, : Identified Q98869.fctr as highly correlated with Q99480.fctr
## [1] "cor(Q123464.fctr, Q123621.fctr)=0.7078"
## [1] "cor(Party.fctr, Q123464.fctr)=-0.0136"
## [1] "cor(Party.fctr, Q123621.fctr)=-0.0255"
## Warning in myfind_cor_features(feats_df = glb_feats_df, obs_df =
## glbObsTrn, : Identified Q123464.fctr as highly correlated with Q123621.fctr
## [1] "cor(Q108754.fctr, Q108855.fctr)=0.7005"
## [1] "cor(Party.fctr, Q108754.fctr)=-0.0081"
## [1] "cor(Party.fctr, Q108855.fctr)=-0.0371"
## Warning in myfind_cor_features(feats_df = glb_feats_df, obs_df =
## glbObsTrn, : Identified Q108754.fctr as highly correlated with Q108855.fctr
## cor.y exclude.as.feat cor.y.abs cor.high.X
## Q109244.fctr 0.1203812469 0 0.1203812469 <NA>
## Hhold.fctr 0.0511386673 0 0.0511386673 <NA>
## Edn.fctr 0.0359295351 0 0.0359295351 <NA>
## Q101163.fctr 0.0295046473 0 0.0295046473 <NA>
## Q100689.fctr 0.0256915080 0 0.0256915080 <NA>
## Q98078.fctr 0.0256516490 0 0.0256516490 <NA>
## Q99716.fctr 0.0209286674 0 0.0209286674 Q99480.fctr
## Q120379.fctr 0.0206291292 0 0.0206291292 <NA>
## Q121699.fctr 0.0196933075 0 0.0196933075 <NA>
## Q105840.fctr 0.0195569165 0 0.0195569165 <NA>
## Q113583.fctr 0.0191894717 0 0.0191894717 <NA>
## Q115195.fctr 0.0174522586 0 0.0174522586 <NA>
## Q102089.fctr 0.0174087944 0 0.0174087944 <NA>
## Q98059.fctr 0.0171637755 0 0.0171637755 Q98078.fctr
## Q114386.fctr 0.0168013326 0 0.0168013326 <NA>
## Q100680.fctr 0.0157762454 0 0.0157762454 Q100689.fctr
## Q108342.fctr 0.0151842510 0 0.0151842510 <NA>
## Q111848.fctr 0.0141099384 0 0.0141099384 <NA>
## YOB.Age.fctr 0.0129198495 0 0.0129198495 <NA>
## Q118892.fctr 0.0125250379 0 0.0125250379 <NA>
## Q102687.fctr 0.0120079165 0 0.0120079165 <NA>
## Q115390.fctr 0.0119300319 0 0.0119300319 <NA>
## Q119851.fctr 0.0093381833 0 0.0093381833 <NA>
## Q114517.fctr 0.0084741753 0 0.0084741753 <NA>
## Q120012.fctr 0.0084652930 0 0.0084652930 <NA>
## Q109367.fctr 0.0080456026 0 0.0080456026 <NA>
## Q114961.fctr 0.0079206587 0 0.0079206587 <NA>
## Q121700.fctr 0.0067756198 0 0.0067756198 <NA>
## Q124122.fctr 0.0061257448 0 0.0061257448 <NA>
## Q111220.fctr 0.0055758571 0 0.0055758571 <NA>
## Q113992.fctr 0.0041479796 0 0.0041479796 <NA>
## .clusterid 0.0038495190 1 0.0038495190 <NA>
## .clusterid.fctr 0.0038495190 0 0.0038495190 <NA>
## Q121011.fctr 0.0037329030 0 0.0037329030 <NA>
## Q106042.fctr 0.0032327194 0 0.0032327194 <NA>
## Q116448.fctr 0.0031731051 0 0.0031731051 <NA>
## Q116601.fctr 0.0022379241 0 0.0022379241 <NA>
## Q104996.fctr 0.0012202806 0 0.0012202806 <NA>
## Q102906.fctr 0.0011540297 0 0.0011540297 <NA>
## Q113584.fctr 0.0011387024 0 0.0011387024 <NA>
## Q108950.fctr 0.0010567028 0 0.0010567028 <NA>
## Q102674.fctr 0.0009759844 0 0.0009759844 <NA>
## Q103293.fctr 0.0005915534 0 0.0005915534 <NA>
## Q112478.fctr 0.0001517248 0 0.0001517248 <NA>
## Q114748.fctr -0.0008477228 0 0.0008477228 <NA>
## Q107491.fctr -0.0014031814 0 0.0014031814 <NA>
## Q100562.fctr -0.0017132769 0 0.0017132769 <NA>
## Q108617.fctr -0.0024119725 0 0.0024119725 <NA>
## Q100010.fctr -0.0024291540 0 0.0024291540 <NA>
## Q115602.fctr -0.0027844465 0 0.0027844465 <NA>
## Q116953.fctr -0.0029786716 0 0.0029786716 <NA>
## Q115610.fctr -0.0035255582 0 0.0035255582 <NA>
## YOB.Age.dff -0.0036305828 0 0.0036305828 <NA>
## Q106997.fctr -0.0041749086 0 0.0041749086 <NA>
## Q120978.fctr -0.0044187616 0 0.0044187616 <NA>
## Q112512.fctr -0.0056768212 0 0.0056768212 <NA>
## Q108343.fctr -0.0060665340 0 0.0060665340 <NA>
## Q96024.fctr -0.0069116541 0 0.0069116541 <NA>
## Q106389.fctr -0.0077498918 0 0.0077498918 <NA>
## .rnorm -0.0078039520 0 0.0078039520 <NA>
## Q108754.fctr -0.0080847764 0 0.0080847764 Q108855.fctr
## Q98578.fctr -0.0081164509 0 0.0081164509 <NA>
## Q101162.fctr -0.0099412952 0 0.0099412952 <NA>
## Q115777.fctr -0.0101315203 0 0.0101315203 <NA>
## Q99581.fctr -0.0103662478 0 0.0103662478 Q99480.fctr
## Q124742.fctr -0.0111642906 0 0.0111642906 <NA>
## Q116797.fctr -0.0112749656 0 0.0112749656 <NA>
## Q112270.fctr -0.0116157798 0 0.0116157798 <NA>
## YOB -0.0116828198 1 0.0116828198 <NA>
## Q118237.fctr -0.0117079669 0 0.0117079669 <NA>
## Q119650.fctr -0.0125645475 0 0.0125645475 <NA>
## Q111580.fctr -0.0132382335 0 0.0132382335 <NA>
## Q123464.fctr -0.0136140083 0 0.0136140083 Q123621.fctr
## Q117193.fctr -0.0138241599 0 0.0138241599 <NA>
## Q99982.fctr -0.0139727928 0 0.0139727928 <NA>
## Q108856.fctr -0.0140363785 0 0.0140363785 Q108855.fctr
## Q118233.fctr -0.0147269325 0 0.0147269325 <NA>
## Q102289.fctr -0.0155850393 0 0.0155850393 <NA>
## Q116197.fctr -0.0158561766 0 0.0158561766 <NA>
## Income.fctr -0.0159635458 0 0.0159635458 <NA>
## Q118232.fctr -0.0171321152 0 0.0171321152 <NA>
## Q120194.fctr -0.0172986920 0 0.0172986920 <NA>
## Q114152.fctr -0.0175013163 0 0.0175013163 <NA>
## Q122770.fctr -0.0194639697 0 0.0194639697 Q122771.fctr
## Q117186.fctr -0.0198853672 0 0.0198853672 <NA>
## Q105655.fctr -0.0198994078 0 0.0198994078 <NA>
## Q106993.fctr -0.0207428635 0 0.0207428635 <NA>
## Q119334.fctr -0.0226894034 0 0.0226894034 <NA>
## Q122120.fctr -0.0229287700 0 0.0229287700 <NA>
## Q116441.fctr -0.0237358205 0 0.0237358205 <NA>
## Q118117.fctr -0.0253544150 0 0.0253544150 <NA>
## Q123621.fctr -0.0255329743 0 0.0255329743 <NA>
## Q122769.fctr -0.0259739146 0 0.0259739146 <NA>
## Q120650.fctr -0.0270889067 0 0.0270889067 Q120472.fctr
## Q98869.fctr -0.0276734114 0 0.0276734114 Q99480.fctr
## .pos -0.0302037138 1 0.0302037138 <NA>
## USER_ID -0.0302304868 1 0.0302304868 <NA>
## Q107869.fctr -0.0304661021 0 0.0304661021 <NA>
## Q120014.fctr -0.0318620439 0 0.0318620439 <NA>
## Q115899.fctr -0.0324177950 0 0.0324177950 <NA>
## Q106388.fctr -0.0341579350 0 0.0341579350 Q106272.fctr
## Q99480.fctr -0.0344412239 0 0.0344412239 <NA>
## Q122771.fctr -0.0348421015 0 0.0348421015 <NA>
## Q108855.fctr -0.0370970211 0 0.0370970211 <NA>
## Q110740.fctr -0.0380691243 0 0.0380691243 <NA>
## Q106272.fctr -0.0400926462 0 0.0400926462 <NA>
## Q101596.fctr -0.0409784077 0 0.0409784077 <NA>
## Q116881.fctr -0.0416860293 0 0.0416860293 <NA>
## Q120472.fctr -0.0462030674 0 0.0462030674 <NA>
## Q98197.fctr -0.0549342527 0 0.0549342527 <NA>
## Q113181.fctr -0.0808753072 0 0.0808753072 <NA>
## Q115611.fctr -0.0904468203 0 0.0904468203 <NA>
## Gender.fctr -0.1027400851 0 0.1027400851 <NA>
## freqRatio percentUnique zeroVar nzv is.cor.y.abs.low
## Q109244.fctr 1.125916 0.05387931 FALSE FALSE FALSE
## Hhold.fctr 1.525094 0.12571839 FALSE FALSE FALSE
## Edn.fctr 1.392610 0.14367816 FALSE FALSE FALSE
## Q101163.fctr 1.327394 0.05387931 FALSE FALSE FALSE
## Q100689.fctr 1.029800 0.05387931 FALSE FALSE FALSE
## Q98078.fctr 1.266595 0.05387931 FALSE FALSE FALSE
## Q99716.fctr 1.328693 0.05387931 FALSE FALSE FALSE
## Q120379.fctr 1.046326 0.05387931 FALSE FALSE FALSE
## Q121699.fctr 1.507127 0.05387931 FALSE FALSE FALSE
## Q105840.fctr 1.275362 0.05387931 FALSE FALSE FALSE
## Q113583.fctr 1.102515 0.05387931 FALSE FALSE FALSE
## Q115195.fctr 1.065496 0.05387931 FALSE FALSE FALSE
## Q102089.fctr 1.055963 0.05387931 FALSE FALSE FALSE
## Q98059.fctr 1.493810 0.05387931 FALSE FALSE FALSE
## Q114386.fctr 1.092072 0.05387931 FALSE FALSE FALSE
## Q100680.fctr 1.102386 0.05387931 FALSE FALSE FALSE
## Q108342.fctr 1.048292 0.05387931 FALSE FALSE FALSE
## Q111848.fctr 1.113602 0.05387931 FALSE FALSE FALSE
## YOB.Age.fctr 1.005794 0.16163793 FALSE FALSE FALSE
## Q118892.fctr 1.347380 0.05387931 FALSE FALSE FALSE
## Q102687.fctr 1.256545 0.05387931 FALSE FALSE FALSE
## Q115390.fctr 1.150505 0.05387931 FALSE FALSE FALSE
## Q119851.fctr 1.244519 0.05387931 FALSE FALSE FALSE
## Q114517.fctr 1.183374 0.05387931 FALSE FALSE FALSE
## Q120012.fctr 1.047185 0.05387931 FALSE FALSE FALSE
## Q109367.fctr 1.008571 0.05387931 FALSE FALSE FALSE
## Q114961.fctr 1.250436 0.05387931 FALSE FALSE FALSE
## Q121700.fctr 1.708221 0.05387931 FALSE FALSE TRUE
## Q124122.fctr 1.412807 0.05387931 FALSE FALSE TRUE
## Q111220.fctr 1.262849 0.05387931 FALSE FALSE TRUE
## Q113992.fctr 1.267442 0.05387931 FALSE FALSE TRUE
## .clusterid 1.690432 0.05387931 FALSE FALSE TRUE
## .clusterid.fctr 1.690432 0.05387931 FALSE FALSE TRUE
## Q121011.fctr 1.153676 0.05387931 FALSE FALSE TRUE
## Q106042.fctr 1.247738 0.05387931 FALSE FALSE TRUE
## Q116448.fctr 1.161031 0.05387931 FALSE FALSE TRUE
## Q116601.fctr 1.394914 0.05387931 FALSE FALSE TRUE
## Q104996.fctr 1.173840 0.05387931 FALSE FALSE TRUE
## Q102906.fctr 1.053396 0.05387931 FALSE FALSE TRUE
## Q113584.fctr 1.212486 0.05387931 FALSE FALSE TRUE
## Q108950.fctr 1.103872 0.05387931 FALSE FALSE TRUE
## Q102674.fctr 1.073412 0.05387931 FALSE FALSE TRUE
## Q103293.fctr 1.122287 0.05387931 FALSE FALSE TRUE
## Q112478.fctr 1.113648 0.05387931 FALSE FALSE TRUE
## Q114748.fctr 1.051125 0.05387931 FALSE FALSE TRUE
## Q107491.fctr 1.419021 0.05387931 FALSE FALSE TRUE
## Q100562.fctr 1.217215 0.05387931 FALSE FALSE TRUE
## Q108617.fctr 1.390618 0.05387931 FALSE FALSE TRUE
## Q100010.fctr 1.268156 0.05387931 FALSE FALSE TRUE
## Q115602.fctr 1.322302 0.05387931 FALSE FALSE TRUE
## Q116953.fctr 1.039180 0.05387931 FALSE FALSE TRUE
## Q115610.fctr 1.359695 0.05387931 FALSE FALSE TRUE
## YOB.Age.dff 1.007778 0.35919540 FALSE FALSE TRUE
## Q106997.fctr 1.177632 0.05387931 FALSE FALSE TRUE
## Q120978.fctr 1.131963 0.05387931 FALSE FALSE TRUE
## Q112512.fctr 1.299253 0.05387931 FALSE FALSE TRUE
## Q108343.fctr 1.064910 0.05387931 FALSE FALSE TRUE
## Q96024.fctr 1.144428 0.05387931 FALSE FALSE TRUE
## Q106389.fctr 1.341307 0.05387931 FALSE FALSE TRUE
## .rnorm 1.000000 100.00000000 FALSE FALSE FALSE
## Q108754.fctr 1.008090 0.05387931 FALSE FALSE FALSE
## Q98578.fctr 1.093556 0.05387931 FALSE FALSE FALSE
## Q101162.fctr 1.103229 0.05387931 FALSE FALSE FALSE
## Q115777.fctr 1.140288 0.05387931 FALSE FALSE FALSE
## Q99581.fctr 1.375000 0.05387931 FALSE FALSE FALSE
## Q124742.fctr 2.565379 0.05387931 FALSE FALSE FALSE
## Q116797.fctr 1.009589 0.05387931 FALSE FALSE FALSE
## Q112270.fctr 1.254284 0.05387931 FALSE FALSE FALSE
## YOB 1.027559 1.41882184 FALSE FALSE FALSE
## Q118237.fctr 1.088017 0.05387931 FALSE FALSE FALSE
## Q119650.fctr 1.456978 0.05387931 FALSE FALSE FALSE
## Q111580.fctr 1.024977 0.05387931 FALSE FALSE FALSE
## Q123464.fctr 1.326681 0.05387931 FALSE FALSE FALSE
## Q117193.fctr 1.140665 0.05387931 FALSE FALSE FALSE
## Q99982.fctr 1.339380 0.05387931 FALSE FALSE FALSE
## Q108856.fctr 1.080645 0.05387931 FALSE FALSE FALSE
## Q118233.fctr 1.199142 0.05387931 FALSE FALSE FALSE
## Q102289.fctr 1.033482 0.05387931 FALSE FALSE FALSE
## Q116197.fctr 1.073778 0.05387931 FALSE FALSE FALSE
## Income.fctr 1.256724 0.12571839 FALSE FALSE FALSE
## Q118232.fctr 1.365812 0.05387931 FALSE FALSE FALSE
## Q120194.fctr 1.016716 0.05387931 FALSE FALSE FALSE
## Q114152.fctr 1.027617 0.05387931 FALSE FALSE FALSE
## Q122770.fctr 1.008802 0.05387931 FALSE FALSE FALSE
## Q117186.fctr 1.053878 0.05387931 FALSE FALSE FALSE
## Q105655.fctr 1.079316 0.05387931 FALSE FALSE FALSE
## Q106993.fctr 1.327392 0.05387931 FALSE FALSE FALSE
## Q119334.fctr 1.081498 0.05387931 FALSE FALSE FALSE
## Q122120.fctr 1.297443 0.05387931 FALSE FALSE FALSE
## Q116441.fctr 1.019645 0.05387931 FALSE FALSE FALSE
## Q118117.fctr 1.174006 0.05387931 FALSE FALSE FALSE
## Q123621.fctr 1.466381 0.05387931 FALSE FALSE FALSE
## Q122769.fctr 1.060606 0.05387931 FALSE FALSE FALSE
## Q120650.fctr 1.896247 0.05387931 FALSE FALSE FALSE
## Q98869.fctr 1.080860 0.05387931 FALSE FALSE FALSE
## .pos 1.000000 100.00000000 FALSE FALSE FALSE
## USER_ID 1.000000 100.00000000 FALSE FALSE FALSE
## Q107869.fctr 1.211050 0.05387931 FALSE FALSE FALSE
## Q120014.fctr 1.044944 0.05387931 FALSE FALSE FALSE
## Q115899.fctr 1.197849 0.05387931 FALSE FALSE FALSE
## Q106388.fctr 1.065033 0.05387931 FALSE FALSE FALSE
## Q99480.fctr 1.225404 0.05387931 FALSE FALSE FALSE
## Q122771.fctr 1.414753 0.05387931 FALSE FALSE FALSE
## Q108855.fctr 1.273980 0.05387931 FALSE FALSE FALSE
## Q110740.fctr 1.050779 0.05387931 FALSE FALSE FALSE
## Q106272.fctr 1.116536 0.05387931 FALSE FALSE FALSE
## Q101596.fctr 1.041667 0.05387931 FALSE FALSE FALSE
## Q116881.fctr 1.010066 0.05387931 FALSE FALSE FALSE
## Q120472.fctr 1.292633 0.05387931 FALSE FALSE FALSE
## Q98197.fctr 1.129371 0.05387931 FALSE FALSE FALSE
## Q113181.fctr 1.006354 0.05387931 FALSE FALSE FALSE
## Q115611.fctr 1.194859 0.05387931 FALSE FALSE FALSE
## Gender.fctr 1.561033 0.05387931 FALSE FALSE FALSE
## Warning in myplot_scatter(plt_feats_df, "percentUnique", "freqRatio",
## colorcol_name = "nzv", : converting nzv to class:factor
## Warning: Removed 3 rows containing missing values (geom_point).
## Warning: Removed 3 rows containing missing values (geom_point).
## Warning: Removed 3 rows containing missing values (geom_point).
## [1] cor.y exclude.as.feat cor.y.abs cor.high.X
## [5] freqRatio percentUnique zeroVar nzv
## [9] is.cor.y.abs.low
## <0 rows> (or 0-length row.names)
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## [1] "numeric data missing in glbObsAll: "
## YOB Party.fctr
## 415 1392
## [1] "numeric data w/ 0s in glbObsAll: "
## YOB.Age.dff
## 438
## [1] "numeric data w/ Infs in glbObsAll: "
## named integer(0)
## [1] "numeric data w/ NaNs in glbObsAll: "
## named integer(0)
## [1] "string data missing in glbObsAll: "
## Gender Income HouseholdStatus EducationLevel
## 143 1273 552 1067
## Party Q124742 Q124122 Q123464
## NA 4340 3114 2912
## Q123621 Q122769 Q122770 Q122771
## 3018 2778 2597 2579
## Q122120 Q121699 Q121700 Q120978
## 2552 2279 2328 2303
## Q121011 Q120379 Q120650 Q120472
## 2256 2361 2283 2433
## Q120194 Q120012 Q120014 Q119334
## 2603 2344 2571 2477
## Q119851 Q119650 Q118892 Q118117
## 2243 2374 2206 2342
## Q118232 Q118233 Q118237 Q117186
## 3018 2659 2592 2845
## Q117193 Q116797 Q116881 Q116953
## 2799 2771 2889 2848
## Q116601 Q116441 Q116448 Q116197
## 2606 2684 2730 2657
## Q115602 Q115777 Q115610 Q115611
## 2619 2785 2637 2443
## Q115899 Q115390 Q114961 Q114748
## 2789 2860 2687 2462
## Q115195 Q114517 Q114386 Q113992
## 2647 2567 2686 2502
## Q114152 Q113583 Q113584 Q113181
## 2829 2632 2654 2576
## Q112478 Q112512 Q112270 Q111848
## 2790 2676 2820 2449
## Q111580 Q111220 Q110740 Q109367
## 2686 2563 2479 2624
## Q108950 Q109244 Q108855 Q108617
## 2641 2731 3008 2696
## Q108856 Q108754 Q108342 Q108343
## 3007 2770 2760 2736
## Q107869 Q107491 Q106993 Q106997
## 2762 2667 2676 2702
## Q106272 Q106388 Q106389 Q106042
## 2722 2818 2871 2762
## Q105840 Q105655 Q104996 Q103293
## 2876 2612 2620 2674
## Q102906 Q102674 Q102687 Q102289
## 2840 2864 2712 2790
## Q102089 Q101162 Q101163 Q101596
## 2736 2816 2995 2824
## Q100689 Q100680 Q100562 Q99982
## 2568 2787 2793 2871
## Q100010 Q99716 Q99581 Q99480
## 2688 2790 2690 2700
## Q98869 Q98578 Q98059 Q98078
## 2906 2867 2629 2945
## Q98197 Q96024 .lcn
## 2836 2858 1392
## [1] "glb_feats_df:"
## [1] 113 12
## id exclude.as.feat rsp_var
## Party.fctr Party.fctr TRUE TRUE
## id cor.y exclude.as.feat cor.y.abs cor.high.X
## USER_ID USER_ID -0.03023049 TRUE 0.03023049 <NA>
## Party.fctr Party.fctr NA TRUE NA <NA>
## freqRatio percentUnique zeroVar nzv is.cor.y.abs.low
## USER_ID 1 100 FALSE FALSE FALSE
## Party.fctr NA NA NA NA NA
## interaction.feat shapiro.test.p.value rsp_var_raw id_var
## USER_ID <NA> NA FALSE TRUE
## Party.fctr <NA> NA NA NA
## rsp_var
## USER_ID NA
## Party.fctr TRUE
## [1] "glb_feats_df vs. glbObsAll: "
## character(0)
## [1] "glbObsAll vs. glb_feats_df: "
## character(0)
## label step_major step_minor label_minor bgn end
## 15 select.features 7 0 0 536.122 543.189
## 16 fit.models 8 0 0 543.189 NA
## elapsed
## 15 7.067
## 16 NA
8.0: fit modelsfit.models_0_chunk_df <- myadd_chunk(NULL, "fit.models_0_bgn", label.minor = "setup")
## label step_major step_minor label_minor bgn end elapsed
## 1 fit.models_0_bgn 1 0 setup 543.872 NA NA
# load(paste0(glbOut$pfx, "dsk.RData"))
get_model_sel_frmla <- function() {
model_evl_terms <- c(NULL)
# min.aic.fit might not be avl
lclMdlEvlCriteria <-
glbMdlMetricsEval[glbMdlMetricsEval %in% names(glb_models_df)]
for (metric in lclMdlEvlCriteria)
model_evl_terms <- c(model_evl_terms,
ifelse(length(grep("max", metric)) > 0, "-", "+"), metric)
if (glb_is_classification && glb_is_binomial)
model_evl_terms <- c(model_evl_terms, "-", "opt.prob.threshold.OOB")
model_sel_frmla <- as.formula(paste(c("~ ", model_evl_terms), collapse = " "))
return(model_sel_frmla)
}
get_dsp_models_df <- function() {
dsp_models_cols <- c("id",
glbMdlMetricsEval[glbMdlMetricsEval %in% names(glb_models_df)],
grep("opt.", names(glb_models_df), fixed = TRUE, value = TRUE))
dsp_models_df <-
#orderBy(get_model_sel_frmla(), glb_models_df)[, c("id", glbMdlMetricsEval)]
orderBy(get_model_sel_frmla(), glb_models_df)[, dsp_models_cols]
nCvMdl <- sapply(glb_models_lst, function(mdl) nrow(mdl$results))
nParams <- sapply(glb_models_lst, function(mdl) ifelse(mdl$method == "custom", 0,
nrow(subset(modelLookup(mdl$method), parameter != "parameter"))))
# nCvMdl <- nCvMdl[names(nCvMdl) != "avNNet"]
# nParams <- nParams[names(nParams) != "avNNet"]
if (length(cvMdlProblems <- nCvMdl[nCvMdl <= nParams]) > 0) {
print("Cross Validation issues:")
warning("Cross Validation issues:")
print(cvMdlProblems)
}
pltMdls <- setdiff(names(nCvMdl), names(cvMdlProblems))
pltMdls <- setdiff(pltMdls, names(nParams[nParams == 0]))
# length(pltMdls) == 21
png(paste0(glbOut$pfx, "bestTune.png"), width = 480 * 2, height = 480 * 4)
grid.newpage()
pushViewport(viewport(layout = grid.layout(ceiling(length(pltMdls) / 2.0), 2)))
pltIx <- 1
for (mdlId in pltMdls) {
print(ggplot(glb_models_lst[[mdlId]], highBestTune = TRUE) + labs(title = mdlId),
vp = viewport(layout.pos.row = ceiling(pltIx / 2.0),
layout.pos.col = ((pltIx - 1) %% 2) + 1))
pltIx <- pltIx + 1
}
dev.off()
if (all(row.names(dsp_models_df) != dsp_models_df$id))
row.names(dsp_models_df) <- dsp_models_df$id
return(dsp_models_df)
}
#get_dsp_models_df()
if (glb_is_classification && glb_is_binomial &&
(length(unique(glbObsFit[, glb_rsp_var])) < 2))
stop("glbObsFit$", glb_rsp_var, ": contains less than 2 unique values: ",
paste0(unique(glbObsFit[, glb_rsp_var]), collapse=", "))
max_cor_y_x_vars <- orderBy(~ -cor.y.abs,
subset(glb_feats_df, (exclude.as.feat == 0) & !nzv & !is.cor.y.abs.low &
is.na(cor.high.X)))[1:2, "id"]
max_cor_y_x_vars <- max_cor_y_x_vars[!is.na(max_cor_y_x_vars)]
if (length(max_cor_y_x_vars) < 2)
max_cor_y_x_vars <- union(max_cor_y_x_vars, ".pos")
if (!is.null(glb_Baseline_mdl_var)) {
if ((max_cor_y_x_vars[1] != glb_Baseline_mdl_var) &
(glb_feats_df[glb_feats_df$id == max_cor_y_x_vars[1], "cor.y.abs"] >
glb_feats_df[glb_feats_df$id == glb_Baseline_mdl_var, "cor.y.abs"]))
stop(max_cor_y_x_vars[1], " has a higher correlation with ", glb_rsp_var,
" than the Baseline var: ", glb_Baseline_mdl_var)
}
glb_model_type <- ifelse(glb_is_regression, "regression", "classification")
# Model specs
# c("id.prefix", "method", "type",
# # trainControl params
# "preProc.method", "cv.n.folds", "cv.n.repeats", "summary.fn",
# # train params
# "metric", "metric.maximize", "tune.df")
# Baseline
if (!is.null(glb_Baseline_mdl_var)) {
fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df,
paste0("fit.models_0_", "Baseline"), major.inc = FALSE,
label.minor = "mybaseln_classfr")
ret_lst <- myfit_mdl(mdl_id="Baseline",
model_method="mybaseln_classfr",
indepVar=glb_Baseline_mdl_var,
rsp_var=glb_rsp_var,
fit_df=glbObsFit, OOB_df=glbObsOOB)
}
# Most Frequent Outcome "MFO" model: mean(y) for regression
# Not using caret's nullModel since model stats not avl
# Cannot use rpart for multinomial classification since it predicts non-MFO
if (glb_is_classification) {
fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df,
paste0("fit.models_0_", "MFO"), major.inc = FALSE,
label.minor = "myMFO_classfr")
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = "MFO", type = glb_model_type, trainControl.method = "none",
train.method = ifelse(glb_is_regression, "lm", "myMFO_classfr"))),
indepVar = ".rnorm", rsp_var = glb_rsp_var,
fit_df = glbObsFit, OOB_df = glbObsOOB)
# "random" model - only for classification;
# none needed for regression since it is same as MFO
fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df,
paste0("fit.models_0_", "Random"), major.inc = FALSE,
label.minor = "myrandom_classfr")
#stop(here"); glb2Sav(); all.equal(glb_models_df, sav_models_df)
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = "Random", type = glb_model_type, trainControl.method = "none",
train.method = "myrandom_classfr")),
indepVar = ".rnorm", rsp_var = glb_rsp_var,
fit_df = glbObsFit, OOB_df = glbObsOOB)
}
## label step_major step_minor label_minor bgn end
## 1 fit.models_0_bgn 1 0 setup 543.872 543.909
## 2 fit.models_0_MFO 1 1 myMFO_classfr 543.910 NA
## elapsed
## 1 0.038
## 2 NA
## [1] "myfit_mdl: enter: 0.000000 secs"
## [1] "fitting model: MFO###myMFO_classfr"
## [1] " indepVar: .rnorm"
## [1] "myfit_mdl: setup complete: 0.524000 secs"
## Fitting parameter = none on full training set
## [1] "in MFO.Classifier$fit"
## [1] "unique.vals:"
## [1] R D
## Levels: R D
## [1] "unique.prob:"
## y
## D R
## 0.5299798 0.4700202
## [1] "MFO.val:"
## [1] "D"
## [1] "myfit_mdl: train complete: 1.871000 secs"
## Length Class Mode
## unique.vals 2 factor numeric
## unique.prob 2 -none- numeric
## MFO.val 1 -none- character
## x.names 1 -none- character
## xNames 1 -none- character
## problemType 1 -none- character
## tuneValue 1 data.frame list
## obsLevels 2 -none- character
## [1] "myfit_mdl: train diagnostics complete: 1.874000 secs"
## Loading required namespace: pROC
## [1] "entr MFO.Classifier$predict"
## [1] "exit MFO.Classifier$predict"
## Loading required package: ROCR
## Loading required package: gplots
##
## Attaching package: 'gplots'
## The following object is masked from 'package:stats':
##
## lowess
## [1] "in MFO.Classifier$prob"
## R D
## 1 0.5299798 0.4700202
## 2 0.5299798 0.4700202
## 3 0.5299798 0.4700202
## 4 0.5299798 0.4700202
## 5 0.5299798 0.4700202
## 6 0.5299798 0.4700202
## Prediction
## Reference R D
## R 0 2093
## D 0 2360
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 0.5299798 0.0000000 0.5151927 0.5447275 0.5299798
## AccuracyPValue McnemarPValue
## 0.5061085 0.0000000
## [1] "entr MFO.Classifier$predict"
## [1] "exit MFO.Classifier$predict"
## [1] "in MFO.Classifier$prob"
## R D
## 1 0.5299798 0.4700202
## 2 0.5299798 0.4700202
## 3 0.5299798 0.4700202
## 4 0.5299798 0.4700202
## 5 0.5299798 0.4700202
## 6 0.5299798 0.4700202
## Prediction
## Reference R D
## R 0 524
## D 0 591
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 5.300448e-01 0.000000e+00 5.002547e-01 5.596760e-01 5.300448e-01
## AccuracyPValue McnemarPValue
## 5.122058e-01 1.552393e-115
## [1] "myfit_mdl: predict complete: 7.773000 secs"
## id feats max.nTuningRuns min.elapsedtime.everything
## 1 MFO###myMFO_classfr .rnorm 0 1.335
## min.elapsedtime.final max.AUCpROC.fit max.Sens.fit max.Spec.fit
## 1 0.004 0.5 0 1
## max.AUCROCR.fit opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1 0.5 0 0.6927932 0.5299798
## max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1 0.5151927 0.5447275 0
## max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1 0.5 0 1 0.5
## opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1 0 0.6928488 0.5300448
## max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1 0.5002547 0.559676 0
## [1] "myfit_mdl: exit: 7.783000 secs"
## label step_major step_minor label_minor bgn
## 2 fit.models_0_MFO 1 1 myMFO_classfr 543.910
## 3 fit.models_0_Random 1 2 myrandom_classfr 551.699
## end elapsed
## 2 551.699 7.789
## 3 NA NA
## [1] "myfit_mdl: enter: 0.000000 secs"
## [1] "fitting model: Random###myrandom_classfr"
## [1] " indepVar: .rnorm"
## [1] "myfit_mdl: setup complete: 0.462000 secs"
## Fitting parameter = none on full training set
## [1] "myfit_mdl: train complete: 0.793000 secs"
## Length Class Mode
## unique.vals 2 factor numeric
## unique.prob 2 table numeric
## xNames 1 -none- character
## problemType 1 -none- character
## tuneValue 1 data.frame list
## obsLevels 2 -none- character
## [1] "myfit_mdl: train diagnostics complete: 0.793000 secs"
## [1] "in Random.Classifier$prob"
## Prediction
## Reference R D
## R 0 2093
## D 0 2360
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 0.5299798 0.0000000 0.5151927 0.5447275 0.5299798
## AccuracyPValue McnemarPValue
## 0.5061085 0.0000000
## [1] "in Random.Classifier$prob"
## Prediction
## Reference R D
## R 0 524
## D 0 591
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 5.300448e-01 0.000000e+00 5.002547e-01 5.596760e-01 5.300448e-01
## AccuracyPValue McnemarPValue
## 5.122058e-01 1.552393e-115
## [1] "myfit_mdl: predict complete: 7.012000 secs"
## id feats max.nTuningRuns
## 1 Random###myrandom_classfr .rnorm 0
## min.elapsedtime.everything min.elapsedtime.final max.AUCpROC.fit
## 1 0.322 0.003 0.4943556
## max.Sens.fit max.Spec.fit max.AUCROCR.fit opt.prob.threshold.fit
## 1 0.4620162 0.5266949 0.4989014 0
## max.f.score.fit max.Accuracy.fit max.AccuracyLower.fit
## 1 0.6927932 0.5299798 0.5151927
## max.AccuracyUpper.fit max.Kappa.fit max.AUCpROC.OOB max.Sens.OOB
## 1 0.5447275 0 0.5268661 0.5038168
## max.Spec.OOB max.AUCROCR.OOB opt.prob.threshold.OOB max.f.score.OOB
## 1 0.5499154 0.5178149 0 0.6928488
## max.Accuracy.OOB max.AccuracyLower.OOB max.AccuracyUpper.OOB
## 1 0.5300448 0.5002547 0.559676
## max.Kappa.OOB
## 1 0
## [1] "myfit_mdl: exit: 7.024000 secs"
# Max.cor.Y
# Check impact of cv
# rpart is not a good candidate since caret does not optimize cp (only tuning parameter of rpart) well
fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df,
paste0("fit.models_0_", "Max.cor.Y.rcv.*X*"), major.inc = FALSE,
label.minor = "glmnet")
## label step_major step_minor label_minor
## 3 fit.models_0_Random 1 2 myrandom_classfr
## 4 fit.models_0_Max.cor.Y.rcv.*X* 1 3 glmnet
## bgn end elapsed
## 3 551.699 558.735 7.037
## 4 558.736 NA NA
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = "Max.cor.Y.rcv.1X1", type = glb_model_type, trainControl.method = "none",
train.method = "glmnet")),
indepVar = max_cor_y_x_vars, rsp_var = glb_rsp_var,
fit_df = glbObsFit, OOB_df = glbObsOOB)
## [1] "myfit_mdl: enter: 0.000000 secs"
## [1] "fitting model: Max.cor.Y.rcv.1X1###glmnet"
## [1] " indepVar: Q109244.fctr,Gender.fctr"
## [1] "myfit_mdl: setup complete: 0.704000 secs"
## Loading required package: glmnet
## Loading required package: Matrix
##
## Attaching package: 'Matrix'
## The following object is masked from 'package:tidyr':
##
## expand
## Loaded glmnet 2.0-5
## Fitting alpha = 0.1, lambda = 0.00303 on full training set
## [1] "myfit_mdl: train complete: 1.728000 secs"
## Length Class Mode
## a0 64 -none- numeric
## beta 256 dgCMatrix S4
## df 64 -none- numeric
## dim 2 -none- numeric
## lambda 64 -none- numeric
## dev.ratio 64 -none- numeric
## nulldev 1 -none- numeric
## npasses 1 -none- numeric
## jerr 1 -none- numeric
## offset 1 -none- logical
## classnames 2 -none- character
## call 5 -none- call
## nobs 1 -none- numeric
## lambdaOpt 1 -none- numeric
## xNames 4 -none- character
## problemType 1 -none- character
## tuneValue 2 data.frame list
## obsLevels 2 -none- character
## [1] "min lambda > lambdaOpt:"
## (Intercept) Gender.fctrM Q109244.fctrNo Q109244.fctrYes
## 0.2976019 -0.2492304 -0.5460175 1.6311860
## [1] "max lambda < lambdaOpt:"
## [1] "Feats mismatch between coefs_left & rght:"
## [1] "(Intercept)" "Gender.fctrF" "Gender.fctrM" "Q109244.fctrNo"
## [5] "Q109244.fctrYes"
## [1] "myfit_mdl: train diagnostics complete: 1.837000 secs"
## Prediction
## Reference R D
## R 0 2093
## D 0 2360
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 0.5299798 0.0000000 0.5151927 0.5447275 0.5299798
## AccuracyPValue McnemarPValue
## 0.5061085 0.0000000
## Prediction
## Reference R D
## R 0 524
## D 0 591
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 5.300448e-01 0.000000e+00 5.002547e-01 5.596760e-01 5.300448e-01
## AccuracyPValue McnemarPValue
## 5.122058e-01 1.552393e-115
## [1] "myfit_mdl: predict complete: 6.372000 secs"
## id feats max.nTuningRuns
## 1 Max.cor.Y.rcv.1X1###glmnet Q109244.fctr,Gender.fctr 0
## min.elapsedtime.everything min.elapsedtime.final max.AUCpROC.fit
## 1 1.013 0.068 0.6195812
## max.Sens.fit max.Spec.fit max.AUCROCR.fit opt.prob.threshold.fit
## 1 0.5671285 0.6720339 0.3267482 0
## max.f.score.fit max.Accuracy.fit max.AccuracyLower.fit
## 1 0.6927932 0.5299798 0.5151927
## max.AccuracyUpper.fit max.Kappa.fit max.AUCpROC.OOB max.Sens.OOB
## 1 0.5447275 0 0.4999322 0.4465649
## max.Spec.OOB max.AUCROCR.OOB opt.prob.threshold.OOB max.f.score.OOB
## 1 0.5532995 0.4910312 0 0.6928488
## max.Accuracy.OOB max.AccuracyLower.OOB max.AccuracyUpper.OOB
## 1 0.5300448 0.5002547 0.559676
## max.Kappa.OOB
## 1 0
## [1] "myfit_mdl: exit: 6.385000 secs"
if (glbMdlCheckRcv) {
# rcv_n_folds == 1 & rcv_n_repeats > 1 crashes
for (rcv_n_folds in seq(3, glb_rcv_n_folds + 2, 2))
for (rcv_n_repeats in seq(1, glb_rcv_n_repeats + 2, 2)) {
# Experiment specific code to avoid caret crash
# lcl_tune_models_df <- rbind(data.frame()
# ,data.frame(method = "glmnet", parameter = "alpha",
# vals = "0.100 0.325 0.550 0.775 1.000")
# ,data.frame(method = "glmnet", parameter = "lambda",
# vals = "9.342e-02")
# )
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst =
list(
id.prefix = paste0("Max.cor.Y.rcv.", rcv_n_folds, "X", rcv_n_repeats),
type = glb_model_type,
# tune.df = lcl_tune_models_df,
trainControl.method = "repeatedcv",
trainControl.number = rcv_n_folds,
trainControl.repeats = rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
train.method = "glmnet", train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize)),
indepVar = max_cor_y_x_vars, rsp_var = glb_rsp_var,
fit_df = glbObsFit, OOB_df = glbObsOOB)
}
# Add parallel coordinates graph of glb_models_df[, glbMdlMetricsEval] to evaluate cv parameters
tmp_models_cols <- c("id", "max.nTuningRuns",
glbMdlMetricsEval[glbMdlMetricsEval %in% names(glb_models_df)],
grep("opt.", names(glb_models_df), fixed = TRUE, value = TRUE))
print(myplot_parcoord(obs_df = subset(glb_models_df,
grepl("Max.cor.Y.rcv.", id, fixed = TRUE),
select = -feats)[, tmp_models_cols],
id_var = "id"))
}
# Useful for stacking decisions
# fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df,
# paste0("fit.models_0_", "Max.cor.Y[rcv.1X1.cp.0|]"), major.inc = FALSE,
# label.minor = "rpart")
#
# ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
# id.prefix = "Max.cor.Y.rcv.1X1.cp.0", type = glb_model_type, trainControl.method = "none",
# train.method = "rpart",
# tune.df=data.frame(method="rpart", parameter="cp", min=0.0, max=0.0, by=0.1))),
# indepVar=max_cor_y_x_vars, rsp_var=glb_rsp_var,
# fit_df=glbObsFit, OOB_df=glbObsOOB)
#stop(here"); glb2Sav(); all.equal(glb_models_df, sav_models_df)
# if (glb_is_regression || glb_is_binomial) # For multinomials this model will be run next by default
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = "Max.cor.Y",
type = glb_model_type, trainControl.method = "repeatedcv",
trainControl.number = glb_rcv_n_folds,
trainControl.repeats = glb_rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
trainControl.allowParallel = glbMdlAllowParallel,
train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize,
train.method = "rpart")),
indepVar = max_cor_y_x_vars, rsp_var = glb_rsp_var,
fit_df = glbObsFit, OOB_df = glbObsOOB)
## [1] "myfit_mdl: enter: 0.000000 secs"
## [1] "fitting model: Max.cor.Y##rcv#rpart"
## [1] " indepVar: Q109244.fctr,Gender.fctr"
## [1] "myfit_mdl: setup complete: 0.706000 secs"
## Loading required package: rpart
## Aggregating results
## Selecting tuning parameters
## Fitting cp = 0.0336 on full training set
## [1] "myfit_mdl: train complete: 2.399000 secs"
## Loading required package: rpart.plot
## Call:
## rpart(formula = .outcome ~ ., control = list(minsplit = 20, minbucket = 7,
## cp = 0, maxcompete = 4, maxsurrogate = 5, usesurrogate = 2,
## surrogatestyle = 0, maxdepth = 30, xval = 0))
## n= 4453
##
## CP nsplit rel error
## 1 0.13425705 0 1.0000000
## 2 0.06306737 1 0.8657430
## 3 0.03356426 2 0.8026756
##
## Variable importance
## Q109244.fctrYes Q109244.fctrNo Gender.fctrM Gender.fctrF
## 82 15 1 1
##
## Node number 1: 4453 observations, complexity param=0.134257
## predicted class=D expected loss=0.4700202 P(node) =1
## class counts: 2093 2360
## probabilities: 0.470 0.530
## left son=2 (3707 obs) right son=3 (746 obs)
## Primary splits:
## Q109244.fctrYes < 0.5 to the left, improve=203.92180, (0 missing)
## Q109244.fctrNo < 0.5 to the right, improve=128.26260, (0 missing)
## Gender.fctrM < 0.5 to the right, improve= 33.63196, (0 missing)
## Gender.fctrF < 0.5 to the left, improve= 32.71833, (0 missing)
##
## Node number 2: 3707 observations, complexity param=0.06306737
## predicted class=R expected loss=0.4620987 P(node) =0.8324725
## class counts: 1994 1713
## probabilities: 0.538 0.462
## left son=4 (1961 obs) right son=5 (1746 obs)
## Primary splits:
## Q109244.fctrNo < 0.5 to the right, improve=37.829750, (0 missing)
## Gender.fctrM < 0.5 to the right, improve=11.923000, (0 missing)
## Gender.fctrF < 0.5 to the left, improve= 9.727259, (0 missing)
## Surrogate splits:
## Gender.fctrM < 0.5 to the right, agree=0.570, adj=0.088, (0 split)
## Gender.fctrF < 0.5 to the left, agree=0.564, adj=0.073, (0 split)
##
## Node number 3: 746 observations
## predicted class=D expected loss=0.1327078 P(node) =0.1675275
## class counts: 99 647
## probabilities: 0.133 0.867
##
## Node number 4: 1961 observations
## predicted class=R expected loss=0.3946966 P(node) =0.4403773
## class counts: 1187 774
## probabilities: 0.605 0.395
##
## Node number 5: 1746 observations
## predicted class=D expected loss=0.4621993 P(node) =0.3920952
## class counts: 807 939
## probabilities: 0.462 0.538
##
## n= 4453
##
## node), split, n, loss, yval, (yprob)
## * denotes terminal node
##
## 1) root 4453 2093 D (0.4700202 0.5299798)
## 2) Q109244.fctrYes< 0.5 3707 1713 R (0.5379013 0.4620987)
## 4) Q109244.fctrNo>=0.5 1961 774 R (0.6053034 0.3946966) *
## 5) Q109244.fctrNo< 0.5 1746 807 D (0.4621993 0.5378007) *
## 3) Q109244.fctrYes>=0.5 746 99 D (0.1327078 0.8672922) *
## [1] "myfit_mdl: train diagnostics complete: 3.370000 secs"
## Prediction
## Reference R D
## R 0 2093
## D 0 2360
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 0.5299798 0.0000000 0.5151927 0.5447275 0.5299798
## AccuracyPValue McnemarPValue
## 0.5061085 0.0000000
## Prediction
## Reference R D
## R 0 524
## D 0 591
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 5.300448e-01 0.000000e+00 5.002547e-01 5.596760e-01 5.300448e-01
## AccuracyPValue McnemarPValue
## 5.122058e-01 1.552393e-115
## [1] "myfit_mdl: predict complete: 7.848000 secs"
## id feats max.nTuningRuns
## 1 Max.cor.Y##rcv#rpart Q109244.fctr,Gender.fctr 5
## min.elapsedtime.everything min.elapsedtime.final max.AUCpROC.fit
## 1 1.684 0.028 0.6195812
## max.Sens.fit max.Spec.fit max.AUCROCR.fit opt.prob.threshold.fit
## 1 0.5671285 0.6720339 0.3369762 0
## max.f.score.fit max.Accuracy.fit max.AccuracyLower.fit
## 1 0.6927932 0.6227314 0.5151927
## max.AccuracyUpper.fit max.Kappa.fit max.AUCpROC.OOB max.Sens.OOB
## 1 0.5447275 0.2400193 0.4999322 0.4465649
## max.Spec.OOB max.AUCROCR.OOB opt.prob.threshold.OOB max.f.score.OOB
## 1 0.5532995 0.4999354 0 0.6928488
## max.Accuracy.OOB max.AccuracyLower.OOB max.AccuracyUpper.OOB
## 1 0.5300448 0.5002547 0.559676
## max.Kappa.OOB max.AccuracySD.fit max.KappaSD.fit
## 1 0 0.01420243 0.02887036
## [1] "myfit_mdl: exit: 7.864000 secs"
if ((length(glbFeatsDateTime) > 0) &&
(sum(grepl(paste(names(glbFeatsDateTime), "\\.day\\.minutes\\.poly\\.", sep = ""),
names(glbObsAll))) > 0)) {
fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df,
paste0("fit.models_0_", "Max.cor.Y.Time.Poly"), major.inc = FALSE,
label.minor = "glmnet")
indepVars <- c(max_cor_y_x_vars,
grep(paste(names(glbFeatsDateTime), "\\.day\\.minutes\\.poly\\.", sep = ""),
names(glbObsAll), value = TRUE))
indepVars <- myadjustInteractionFeats(glb_feats_df, indepVars)
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = "Max.cor.Y.Time.Poly",
type = glb_model_type, trainControl.method = "repeatedcv",
trainControl.number = glb_rcv_n_folds, trainControl.repeats = glb_rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
trainControl.allowParallel = glbMdlAllowParallel,
train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize,
train.method = "glmnet")),
indepVar = indepVars,
rsp_var = glb_rsp_var,
fit_df = glbObsFit, OOB_df = glbObsOOB)
}
if ((length(glbFeatsDateTime) > 0) &&
(sum(grepl(paste(names(glbFeatsDateTime), "\\.last[[:digit:]]", sep = ""),
names(glbObsAll))) > 0)) {
fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df,
paste0("fit.models_0_", "Max.cor.Y.Time.Lag"), major.inc = FALSE,
label.minor = "glmnet")
indepVars <- c(max_cor_y_x_vars,
grep(paste(names(glbFeatsDateTime), "\\.last[[:digit:]]", sep = ""),
names(glbObsAll), value = TRUE))
indepVars <- myadjustInteractionFeats(glb_feats_df, indepVars)
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = "Max.cor.Y.Time.Lag",
type = glb_model_type,
tune.df = glbMdlTuneParams,
trainControl.method = "repeatedcv",
trainControl.number = glb_rcv_n_folds, trainControl.repeats = glb_rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
trainControl.allowParallel = glbMdlAllowParallel,
train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize,
train.method = "glmnet")),
indepVar = indepVars,
rsp_var = glb_rsp_var,
fit_df = glbObsFit, OOB_df = glbObsOOB)
}
if (length(glbFeatsText) > 0) {
fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df,
paste0("fit.models_0_", "Txt.*"), major.inc = FALSE,
label.minor = "glmnet")
indepVars <- c(max_cor_y_x_vars)
for (txtFeat in names(glbFeatsText))
indepVars <- union(indepVars,
grep(paste(str_to_upper(substr(txtFeat, 1, 1)), "\\.(?!([T|P]\\.))", sep = ""),
names(glbObsAll), perl = TRUE, value = TRUE))
indepVars <- myadjustInteractionFeats(glb_feats_df, indepVars)
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = "Max.cor.Y.Text.nonTP",
type = glb_model_type,
tune.df = glbMdlTuneParams,
trainControl.method = "repeatedcv",
trainControl.number = glb_rcv_n_folds, trainControl.repeats = glb_rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
trainControl.allowParallel = glbMdlAllowParallel,
train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize,
train.method = "glmnet")),
indepVar = indepVars,
rsp_var = glb_rsp_var,
fit_df = glbObsFit, OOB_df = glbObsOOB)
indepVars <- c(max_cor_y_x_vars)
for (txtFeat in names(glbFeatsText))
indepVars <- union(indepVars,
grep(paste(str_to_upper(substr(txtFeat, 1, 1)), "\\.T\\.", sep = ""),
names(glbObsAll), perl = TRUE, value = TRUE))
indepVars <- myadjustInteractionFeats(glb_feats_df, indepVars)
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = "Max.cor.Y.Text.onlyT",
type = glb_model_type,
tune.df = glbMdlTuneParams,
trainControl.method = "repeatedcv",
trainControl.number = glb_rcv_n_folds, trainControl.repeats = glb_rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize,
train.method = "glmnet")),
indepVar = indepVars,
rsp_var = glb_rsp_var,
fit_df = glbObsFit, OOB_df = glbObsOOB)
indepVars <- c(max_cor_y_x_vars)
for (txtFeat in names(glbFeatsText))
indepVars <- union(indepVars,
grep(paste(str_to_upper(substr(txtFeat, 1, 1)), "\\.P\\.", sep = ""),
names(glbObsAll), perl = TRUE, value = TRUE))
indepVars <- myadjustInteractionFeats(glb_feats_df, indepVars)
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = "Max.cor.Y.Text.onlyP",
type = glb_model_type,
tune.df = glbMdlTuneParams,
trainControl.method = "repeatedcv",
trainControl.number = glb_rcv_n_folds, trainControl.repeats = glb_rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
trainControl.allowParallel = glbMdlAllowParallel,
train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize,
train.method = "glmnet")),
indepVar = indepVars,
rsp_var = glb_rsp_var,
fit_df = glbObsFit, OOB_df = glbObsOOB)
}
# Interactions.High.cor.Y
if (length(int_feats <- setdiff(setdiff(unique(glb_feats_df$cor.high.X), NA),
subset(glb_feats_df, nzv)$id)) > 0) {
fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df,
paste0("fit.models_0_", "Interact.High.cor.Y"), major.inc = FALSE,
label.minor = "glmnet")
ret_lst <- myfit_mdl(mdl_specs_lst=myinit_mdl_specs_lst(mdl_specs_lst=list(
id.prefix="Interact.High.cor.Y",
type=glb_model_type, trainControl.method="repeatedcv",
trainControl.number=glb_rcv_n_folds, trainControl.repeats=glb_rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
trainControl.allowParallel = glbMdlAllowParallel,
train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize,
train.method="glmnet")),
indepVar=c(max_cor_y_x_vars, paste(max_cor_y_x_vars[1], int_feats, sep=":")),
rsp_var=glb_rsp_var,
fit_df=glbObsFit, OOB_df=glbObsOOB)
}
## label step_major step_minor label_minor
## 4 fit.models_0_Max.cor.Y.rcv.*X* 1 3 glmnet
## 5 fit.models_0_Interact.High.cor.Y 1 4 glmnet
## bgn end elapsed
## 4 558.736 573.028 14.293
## 5 573.029 NA NA
## [1] "myfit_mdl: enter: 0.000000 secs"
## [1] "fitting model: Interact.High.cor.Y##rcv#glmnet"
## [1] " indepVar: Q109244.fctr,Gender.fctr,Q109244.fctr:Q99480.fctr,Q109244.fctr:Q98078.fctr,Q109244.fctr:Q100689.fctr,Q109244.fctr:Q108855.fctr,Q109244.fctr:Q123621.fctr,Q109244.fctr:Q122771.fctr,Q109244.fctr:Q120472.fctr,Q109244.fctr:Q106272.fctr"
## [1] "myfit_mdl: setup complete: 0.705000 secs"
## Aggregating results
## Selecting tuning parameters
## Fitting alpha = 0.55, lambda = 0.00303 on full training set
## [1] "myfit_mdl: train complete: 6.012000 secs"
## Length Class Mode
## a0 72 -none- numeric
## beta 3744 dgCMatrix S4
## df 72 -none- numeric
## dim 2 -none- numeric
## lambda 72 -none- numeric
## dev.ratio 72 -none- numeric
## nulldev 1 -none- numeric
## npasses 1 -none- numeric
## jerr 1 -none- numeric
## offset 1 -none- logical
## classnames 2 -none- character
## call 5 -none- call
## nobs 1 -none- numeric
## lambdaOpt 1 -none- numeric
## xNames 52 -none- character
## problemType 1 -none- character
## tuneValue 2 data.frame list
## obsLevels 2 -none- character
## [1] "min lambda > lambdaOpt:"
## (Intercept) Gender.fctrM
## 0.30474474 -0.19235176
## Q109244.fctrNo Q109244.fctrYes
## -0.46779597 0.90303181
## Q109244.fctrNA:Q100689.fctrNo Q109244.fctrNo:Q100689.fctrNo
## 0.08937757 -0.12012631
## Q109244.fctrYes:Q100689.fctrNo Q109244.fctrNA:Q100689.fctrYes
## -0.03138994 0.35071312
## Q109244.fctrNo:Q100689.fctrYes Q109244.fctrYes:Q100689.fctrYes
## 0.05118867 0.39864211
## Q109244.fctrNA:Q106272.fctrNo Q109244.fctrNo:Q106272.fctrNo
## -0.05134160 0.06405302
## Q109244.fctrYes:Q106272.fctrNo Q109244.fctrNA:Q106272.fctrYes
## -0.08205810 -0.16747603
## Q109244.fctrYes:Q106272.fctrYes Q109244.fctrNA:Q108855.fctrUmm...
## 0.18585910 -0.16078900
## Q109244.fctrYes:Q108855.fctrUmm... Q109244.fctrNA:Q108855.fctrYes!
## 0.04539680 -0.13043743
## Q109244.fctrNo:Q108855.fctrYes! Q109244.fctrNo:Q120472.fctrArt
## -0.20995064 0.01730102
## Q109244.fctrYes:Q120472.fctrArt Q109244.fctrNA:Q120472.fctrScience
## 0.71571590 -0.11001508
## Q109244.fctrNo:Q120472.fctrScience Q109244.fctrYes:Q120472.fctrScience
## -0.07407132 -0.04959913
## Q109244.fctrYes:Q122771.fctrPc Q109244.fctrNA:Q122771.fctrPt
## 0.15205641 -0.25453650
## Q109244.fctrNo:Q122771.fctrPt Q109244.fctrYes:Q122771.fctrPt
## -0.23913386 -0.16063240
## Q109244.fctrNA:Q123621.fctrNo Q109244.fctrYes:Q123621.fctrNo
## -0.09400933 0.10314275
## Q109244.fctrNA:Q123621.fctrYes Q109244.fctrNo:Q123621.fctrYes
## -0.02524789 -0.11277084
## Q109244.fctrYes:Q123621.fctrYes Q109244.fctrNA:Q98078.fctrNo
## 0.07791017 0.25367620
## Q109244.fctrNo:Q98078.fctrNo Q109244.fctrYes:Q98078.fctrNo
## 0.12016433 0.15277814
## Q109244.fctrNA:Q98078.fctrYes Q109244.fctrYes:Q98078.fctrYes
## 0.18413697 0.33674598
## Q109244.fctrNA:Q99480.fctrNo Q109244.fctrNo:Q99480.fctrNo
## 0.29436751 0.37378839
## Q109244.fctrNA:Q99480.fctrYes Q109244.fctrNo:Q99480.fctrYes
## -0.28289751 -0.02938347
## [1] "max lambda < lambdaOpt:"
## (Intercept) Gender.fctrM
## 0.30665943 -0.19291421
## Q109244.fctrNo Q109244.fctrYes
## -0.47604533 0.91411986
## Q109244.fctrNA:Q100689.fctrNo Q109244.fctrNo:Q100689.fctrNo
## 0.09793173 -0.11545941
## Q109244.fctrYes:Q100689.fctrNo Q109244.fctrNA:Q100689.fctrYes
## -0.05251406 0.36007759
## Q109244.fctrNo:Q100689.fctrYes Q109244.fctrYes:Q100689.fctrYes
## 0.05953033 0.38676277
## Q109244.fctrNA:Q106272.fctrNo Q109244.fctrNo:Q106272.fctrNo
## -0.06156608 0.06654080
## Q109244.fctrYes:Q106272.fctrNo Q109244.fctrNA:Q106272.fctrYes
## -0.10686255 -0.17341318
## Q109244.fctrYes:Q106272.fctrYes Q109244.fctrNA:Q108855.fctrUmm...
## 0.17614268 -0.16629690
## Q109244.fctrYes:Q108855.fctrUmm... Q109244.fctrNA:Q108855.fctrYes!
## 0.04857188 -0.13404471
## Q109244.fctrNo:Q108855.fctrYes! Q109244.fctrNo:Q120472.fctrArt
## -0.21128031 0.02156135
## Q109244.fctrYes:Q120472.fctrArt Q109244.fctrNA:Q120472.fctrScience
## 0.70998060 -0.11193096
## Q109244.fctrNo:Q120472.fctrScience Q109244.fctrYes:Q120472.fctrScience
## -0.07337946 -0.07437396
## Q109244.fctrYes:Q122771.fctrPc Q109244.fctrNA:Q122771.fctrPt
## 0.14010536 -0.25858914
## Q109244.fctrNo:Q122771.fctrPt Q109244.fctrYes:Q122771.fctrPt
## -0.24120138 -0.18715985
## Q109244.fctrNA:Q123621.fctrNo Q109244.fctrYes:Q123621.fctrNo
## -0.09719484 0.13358947
## Q109244.fctrNA:Q123621.fctrYes Q109244.fctrNo:Q123621.fctrYes
## -0.02795962 -0.11513907
## Q109244.fctrYes:Q123621.fctrYes Q109244.fctrNA:Q98078.fctrNo
## 0.10598422 0.26284104
## Q109244.fctrNo:Q98078.fctrNo Q109244.fctrYes:Q98078.fctrNo
## 0.12389247 0.18077231
## Q109244.fctrNA:Q98078.fctrYes Q109244.fctrYes:Q98078.fctrYes
## 0.19266360 0.36290785
## Q109244.fctrNA:Q99480.fctrNo Q109244.fctrNo:Q99480.fctrNo
## 0.29259663 0.37381307
## Q109244.fctrNA:Q99480.fctrYes Q109244.fctrNo:Q99480.fctrYes
## -0.29170558 -0.03235030
## [1] "myfit_mdl: train diagnostics complete: 6.800000 secs"
## Prediction
## Reference R D
## R 297 1796
## D 137 2223
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 5.659106e-01 8.778692e-02 5.512016e-01 5.805331e-01 5.299798e-01
## AccuracyPValue McnemarPValue
## 8.028465e-07 3.273812e-311
## Prediction
## Reference R D
## R 0 524
## D 0 591
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 5.300448e-01 0.000000e+00 5.002547e-01 5.596760e-01 5.300448e-01
## AccuracyPValue McnemarPValue
## 5.122058e-01 1.552393e-115
## [1] "myfit_mdl: predict complete: 12.068000 secs"
## id
## 1 Interact.High.cor.Y##rcv#glmnet
## feats
## 1 Q109244.fctr,Gender.fctr,Q109244.fctr:Q99480.fctr,Q109244.fctr:Q98078.fctr,Q109244.fctr:Q100689.fctr,Q109244.fctr:Q108855.fctr,Q109244.fctr:Q123621.fctr,Q109244.fctr:Q122771.fctr,Q109244.fctr:Q120472.fctr,Q109244.fctr:Q106272.fctr
## max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1 25 5.288 0.346
## max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1 0.6372713 0.6364071 0.6381356 0.3046595
## opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1 0.35 0.6969744 0.6276719
## max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1 0.5512016 0.5805331 0.2550614
## max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1 0.515779 0.5171756 0.5143824 0.4731743
## opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1 0 0.6928488 0.5300448
## max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1 0.5002547 0.559676 0
## max.AccuracySD.fit max.KappaSD.fit
## 1 0.0127242 0.02650871
## [1] "myfit_mdl: exit: 12.082000 secs"
# Low.cor.X
fit.models_0_chunk_df <- myadd_chunk(fit.models_0_chunk_df,
paste0("fit.models_0_", "Low.cor.X"), major.inc = FALSE,
label.minor = "glmnet")
## label step_major step_minor label_minor
## 5 fit.models_0_Interact.High.cor.Y 1 4 glmnet
## 6 fit.models_0_Low.cor.X 1 5 glmnet
## bgn end elapsed
## 5 573.029 585.14 12.111
## 6 585.141 NA NA
indepVar <- mygetIndepVar(glb_feats_df)
ret_lst <- myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = "Low.cor.X",
type = glb_model_type,
tune.df = glbMdlTuneParams,
trainControl.method = "repeatedcv",
trainControl.number = glb_rcv_n_folds, trainControl.repeats = glb_rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
trainControl.allowParallel = glbMdlAllowParallel,
train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize,
train.method = "glmnet")),
indepVar = indepVar, rsp_var = glb_rsp_var,
fit_df = glbObsFit, OOB_df = glbObsOOB)
## [1] "myfit_mdl: enter: 0.000000 secs"
## [1] "fitting model: Low.cor.X##rcv#glmnet"
## [1] " indepVar: Q109244.fctr,Hhold.fctr,Edn.fctr,Q101163.fctr,Q100689.fctr,Q98078.fctr,Q99716.fctr,Q120379.fctr,Q121699.fctr,Q105840.fctr,Q113583.fctr,Q115195.fctr,Q102089.fctr,Q98059.fctr,Q114386.fctr,Q100680.fctr,Q108342.fctr,Q111848.fctr,YOB.Age.fctr,Q118892.fctr,Q102687.fctr,Q115390.fctr,Q119851.fctr,Q114517.fctr,Q120012.fctr,Q109367.fctr,Q114961.fctr,Q121700.fctr,Q124122.fctr,Q111220.fctr,Q113992.fctr,Q121011.fctr,Q106042.fctr,Q116448.fctr,Q116601.fctr,Q104996.fctr,Q102906.fctr,Q113584.fctr,Q108950.fctr,Q102674.fctr,Q103293.fctr,Q112478.fctr,Q114748.fctr,Q107491.fctr,Q100562.fctr,Q108617.fctr,Q100010.fctr,Q115602.fctr,Q116953.fctr,Q115610.fctr,Q106997.fctr,Q120978.fctr,Q112512.fctr,Q108343.fctr,Q96024.fctr,Q106389.fctr,.rnorm,Q108754.fctr,Q98578.fctr,Q101162.fctr,Q115777.fctr,Q99581.fctr,Q124742.fctr,Q116797.fctr,Q112270.fctr,Q118237.fctr,Q119650.fctr,Q111580.fctr,Q123464.fctr,Q117193.fctr,Q99982.fctr,Q108856.fctr,Q118233.fctr,Q102289.fctr,Q116197.fctr,Income.fctr,Q118232.fctr,Q120194.fctr,Q114152.fctr,Q122770.fctr,Q117186.fctr,Q105655.fctr,Q106993.fctr,Q119334.fctr,Q122120.fctr,Q116441.fctr,Q118117.fctr,Q123621.fctr,Q122769.fctr,Q120650.fctr,Q98869.fctr,Q107869.fctr,Q120014.fctr,Q115899.fctr,Q106388.fctr,Q99480.fctr,Q122771.fctr,Q108855.fctr,Q110740.fctr,Q106272.fctr,Q101596.fctr,Q116881.fctr,Q120472.fctr,Q98197.fctr,Q113181.fctr,Q115611.fctr,Gender.fctr,Q109244.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff"
## [1] "myfit_mdl: setup complete: 0.685000 secs"
## Aggregating results
## Selecting tuning parameters
## Fitting alpha = 0.1, lambda = 0.0652 on full training set
## [1] "myfit_mdl: train complete: 26.201000 secs"
## Warning in myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst
## = list(id.prefix = "Low.cor.X", : model's bestTune found at an extreme of
## tuneGrid for parameter: alpha
## Warning in myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst
## = list(id.prefix = "Low.cor.X", : model's bestTune found at an extreme of
## tuneGrid for parameter: lambda
## Length Class Mode
## a0 92 -none- numeric
## beta 22724 dgCMatrix S4
## df 92 -none- numeric
## dim 2 -none- numeric
## lambda 92 -none- numeric
## dev.ratio 92 -none- numeric
## nulldev 1 -none- numeric
## npasses 1 -none- numeric
## jerr 1 -none- numeric
## offset 1 -none- logical
## classnames 2 -none- character
## call 5 -none- call
## nobs 1 -none- numeric
## lambdaOpt 1 -none- numeric
## xNames 247 -none- character
## problemType 1 -none- character
## tuneValue 2 data.frame list
## obsLevels 2 -none- character
## [1] "min lambda > lambdaOpt:"
## (Intercept) .rnorm
## 0.2086644068 -0.0040676082
## Edn.fctr.L Edn.fctr^6
## 0.0807593733 0.0037049998
## Edn.fctr^7 Gender.fctrF
## 0.0109130085 0.0175273672
## Gender.fctrM Hhold.fctrMKy
## -0.0975008166 -0.0917112139
## Hhold.fctrPKn Hhold.fctrSKy
## 0.4801925403 0.0860632190
## Income.fctr.Q Income.fctr.C
## -0.1167443486 -0.0618266878
## Q100689.fctrYes Q101163.fctrDad
## 0.0916223483 -0.1174179957
## Q101163.fctrMom Q101596.fctrYes
## 0.0690167583 -0.0149916083
## Q102089.fctrRent Q102687.fctrYes
## 0.0397274885 0.0236799740
## Q104996.fctrNo Q104996.fctrYes
## -0.0384366155 0.0082970435
## Q105655.fctrYes Q105840.fctrNo
## -0.0103747720 -0.0108299455
## Q105840.fctrYes Q106042.fctrNo
## 0.0336072662 -0.0681056248
## Q106388.fctrYes Q106389.fctrNo
## -0.0222148609 -0.0341247333
## Q106997.fctrGr Q107869.fctrNo
## -0.0410948349 0.0062341950
## Q108342.fctrOnline Q108754.fctrYes
## 0.0482821727 -0.0332250858
## Q108855.fctrYes! Q108856.fctrSocialize
## -0.0244465573 -0.0298124454
## Q109244.fctrNo Q109244.fctrYes
## -0.4233306042 0.8673728628
## Q109367.fctrYes Q110740.fctrPC
## 0.0075309573 -0.0812633625
## Q111220.fctrNo Q111220.fctrYes
## -0.0028992659 0.0548562552
## Q111848.fctrYes Q112270.fctrNo
## 0.0422254964 0.0003926562
## Q112478.fctrNo Q113181.fctrNo
## -0.0287283353 0.1208500531
## Q113181.fctrYes Q113583.fctrTunes
## -0.1721653557 0.0191272307
## Q113992.fctrYes Q114517.fctrNo
## 0.0026477157 0.0298295402
## Q115195.fctrNo Q115195.fctrYes
## -0.0079655514 0.0274792793
## Q115390.fctrYes Q115610.fctrNo
## 0.0433150081 -0.0192191439
## Q115611.fctrNo Q115611.fctrYes
## 0.1197804457 -0.2812318027
## Q115899.fctrCs Q115899.fctrMe
## 0.0713773936 -0.0289640943
## Q116197.fctrA.M. Q116881.fctrHappy
## -0.0110939396 0.0144345169
## Q116881.fctrRight Q116953.fctrNo
## -0.1586375438 -0.0604468028
## Q118117.fctrYes Q118232.fctrId
## -0.0356424665 0.0967572276
## Q118233.fctrNo Q118892.fctrNo
## -0.0476696274 -0.0101337298
## Q119851.fctrNo Q119851.fctrYes
## -0.0747510956 0.0896931372
## Q120012.fctrYes Q120014.fctrNo
## 0.0266469396 0.0108260492
## Q120014.fctrYes Q120194.fctrStudy first
## -0.0071405452 0.0010046252
## Q120379.fctrNo Q120379.fctrYes
## -0.0230881465 0.0722805146
## Q120472.fctrScience Q120650.fctrNo
## -0.0777170361 0.0115894753
## Q121699.fctrYes Q122120.fctrYes
## 0.0566089666 -0.0707418237
## Q122771.fctrPt Q123621.fctrYes
## -0.0962320118 -0.0018081407
## Q124122.fctrNo Q124742.fctrNo
## -0.0088367827 0.0311087872
## Q98059.fctrOnly-child Q98059.fctrYes
## -0.0379123244 0.0373348517
## Q98197.fctrNo Q98197.fctrYes
## 0.1656648663 -0.1218575980
## Q98869.fctrNo Q99480.fctrNo
## 0.2533897602 0.1223858992
## Q99480.fctrYes Q99716.fctrYes
## -0.0522373638 0.0479268633
## YOB.Age.fctr.L YOB.Age.fctr^8
## 0.0939646970 -0.0340229370
## Q109244.fctrYes:.clusterid.fctr2 Q109244.fctrNo:.clusterid.fctr3
## 0.1462699802 -0.0267021748
## Q109244.fctrYes:.clusterid.fctr3 YOB.Age.fctr(30,35]:YOB.Age.dff
## 0.6434456849 -0.0054183207
## YOB.Age.fctr(35,40]:YOB.Age.dff YOB.Age.fctr(40,50]:YOB.Age.dff
## 0.0714364573 -0.0003430897
## [1] "max lambda < lambdaOpt:"
## (Intercept) .rnorm
## 0.2133116408 -0.0063580846
## Edn.fctr.L Edn.fctr^4
## 0.0855088630 -0.0006733155
## Edn.fctr^6 Edn.fctr^7
## 0.0104415796 0.0169153579
## Gender.fctrF Gender.fctrM
## 0.0120614113 -0.0998204566
## Hhold.fctrMKy Hhold.fctrPKn
## -0.0971229287 0.4982311801
## Hhold.fctrSKy Income.fctr.Q
## 0.0980579205 -0.1236872013
## Income.fctr.C Q100689.fctrYes
## -0.0721016259 0.0991483660
## Q101162.fctrPessimist Q101163.fctrDad
## -0.0021383985 -0.1222799255
## Q101163.fctrMom Q101596.fctrYes
## 0.0708708260 -0.0194907319
## Q102089.fctrRent Q102687.fctrYes
## 0.0430274966 0.0302665215
## Q102906.fctrYes Q104996.fctrNo
## -0.0053679772 -0.0428684755
## Q104996.fctrYes Q105655.fctrYes
## 0.0129695841 -0.0156314570
## Q105840.fctrNo Q105840.fctrYes
## -0.0087099928 0.0363178280
## Q106042.fctrNo Q106388.fctrYes
## -0.0714315958 -0.0258114314
## Q106389.fctrNo Q106997.fctrGr
## -0.0405401997 -0.0477850922
## Q107869.fctrNo Q108342.fctrOnline
## 0.0123815444 0.0541889369
## Q108754.fctrYes Q108855.fctrYes!
## -0.0395679490 -0.0286372736
## Q108856.fctrSocialize Q109244.fctrNo
## -0.0366184596 -0.4304273946
## Q109244.fctrYes Q109367.fctrYes
## 0.8859332171 0.0096264253
## Q110740.fctrMac Q110740.fctrPC
## 0.0016062166 -0.0871089509
## Q111220.fctrNo Q111220.fctrYes
## -0.0064779703 0.0602733531
## Q111848.fctrYes Q112270.fctrNo
## 0.0489308979 0.0041590948
## Q112478.fctrNo Q113181.fctrNo
## -0.0336132254 0.1222078279
## Q113181.fctrYes Q113583.fctrTunes
## -0.1769077838 0.0232944887
## Q113992.fctrYes Q114517.fctrNo
## 0.0093114211 0.0363977845
## Q115195.fctrNo Q115195.fctrYes
## -0.0117013636 0.0300167127
## Q115390.fctrYes Q115610.fctrNo
## 0.0493692970 -0.0264929967
## Q115611.fctrNo Q115611.fctrYes
## 0.1195966557 -0.2886833828
## Q115899.fctrCs Q115899.fctrMe
## 0.0767471002 -0.0310474147
## Q116197.fctrA.M. Q116881.fctrHappy
## -0.0178577032 0.0186990229
## Q116881.fctrRight Q116953.fctrNo
## -0.1627119311 -0.0678083129
## Q118117.fctrYes Q118232.fctrId
## -0.0384748338 0.1049607291
## Q118233.fctrNo Q118892.fctrNo
## -0.0551602210 -0.0116647542
## Q119851.fctrNo Q119851.fctrYes
## -0.0785778058 0.0939051159
## Q120012.fctrYes Q120014.fctrNo
## 0.0314354375 0.0133418508
## Q120014.fctrYes Q120194.fctrStudy first
## -0.0095710830 0.0046369879
## Q120379.fctrNo Q120379.fctrYes
## -0.0264476527 0.0781396918
## Q120472.fctrScience Q120650.fctrNo
## -0.0831398605 0.0214397919
## Q121011.fctrNo Q121011.fctrYes
## -0.0006193183 0.0007349370
## Q121699.fctrYes Q122120.fctrYes
## 0.0621928559 -0.0787327327
## Q122771.fctrPt Q123621.fctrYes
## -0.1051539163 -0.0071296472
## Q124122.fctrNo Q124742.fctrNo
## -0.0139014911 0.0398117762
## Q96024.fctrNo Q98059.fctrOnly-child
## 0.0042966064 -0.0512494295
## Q98059.fctrYes Q98197.fctrNo
## 0.0448973136 0.1689994948
## Q98197.fctrYes Q98869.fctrNo
## -0.1250279025 0.2630244707
## Q99480.fctrNo Q99480.fctrYes
## 0.1266614399 -0.0591442546
## Q99716.fctrYes YOB.Age.fctr.L
## 0.0505441934 0.1052236239
## YOB.Age.fctr.Q YOB.Age.fctr^8
## 0.0055981032 -0.0341534347
## Q109244.fctrYes:.clusterid.fctr2 Q109244.fctrNo:.clusterid.fctr3
## 0.1463559578 -0.0262516542
## Q109244.fctrYes:.clusterid.fctr3 YOB.Age.fctr(30,35]:YOB.Age.dff
## 0.6643435951 -0.0080024138
## YOB.Age.fctr(35,40]:YOB.Age.dff YOB.Age.fctr(40,50]:YOB.Age.dff
## 0.0754472783 -0.0017757125
## [1] "myfit_mdl: train diagnostics complete: 26.868000 secs"
## Prediction
## Reference R D
## R 995 1098
## D 394 1966
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 6.649450e-01 3.144277e-01 6.508645e-01 6.788088e-01 5.299798e-01
## AccuracyPValue McnemarPValue
## 1.133086e-74 5.162652e-74
## Prediction
## Reference R D
## R 7 517
## D 2 589
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 5.345291e-01 1.056316e-02 5.047442e-01 5.641315e-01 5.300448e-01
## AccuracyPValue McnemarPValue
## 3.937954e-01 1.021659e-112
## [1] "myfit_mdl: predict complete: 37.086000 secs"
## id
## 1 Low.cor.X##rcv#glmnet
## feats
## 1 Q109244.fctr,Hhold.fctr,Edn.fctr,Q101163.fctr,Q100689.fctr,Q98078.fctr,Q99716.fctr,Q120379.fctr,Q121699.fctr,Q105840.fctr,Q113583.fctr,Q115195.fctr,Q102089.fctr,Q98059.fctr,Q114386.fctr,Q100680.fctr,Q108342.fctr,Q111848.fctr,YOB.Age.fctr,Q118892.fctr,Q102687.fctr,Q115390.fctr,Q119851.fctr,Q114517.fctr,Q120012.fctr,Q109367.fctr,Q114961.fctr,Q121700.fctr,Q124122.fctr,Q111220.fctr,Q113992.fctr,Q121011.fctr,Q106042.fctr,Q116448.fctr,Q116601.fctr,Q104996.fctr,Q102906.fctr,Q113584.fctr,Q108950.fctr,Q102674.fctr,Q103293.fctr,Q112478.fctr,Q114748.fctr,Q107491.fctr,Q100562.fctr,Q108617.fctr,Q100010.fctr,Q115602.fctr,Q116953.fctr,Q115610.fctr,Q106997.fctr,Q120978.fctr,Q112512.fctr,Q108343.fctr,Q96024.fctr,Q106389.fctr,.rnorm,Q108754.fctr,Q98578.fctr,Q101162.fctr,Q115777.fctr,Q99581.fctr,Q124742.fctr,Q116797.fctr,Q112270.fctr,Q118237.fctr,Q119650.fctr,Q111580.fctr,Q123464.fctr,Q117193.fctr,Q99982.fctr,Q108856.fctr,Q118233.fctr,Q102289.fctr,Q116197.fctr,Income.fctr,Q118232.fctr,Q120194.fctr,Q114152.fctr,Q122770.fctr,Q117186.fctr,Q105655.fctr,Q106993.fctr,Q119334.fctr,Q122120.fctr,Q116441.fctr,Q118117.fctr,Q123621.fctr,Q122769.fctr,Q120650.fctr,Q98869.fctr,Q107869.fctr,Q120014.fctr,Q115899.fctr,Q106388.fctr,Q99480.fctr,Q122771.fctr,Q108855.fctr,Q110740.fctr,Q106272.fctr,Q101596.fctr,Q116881.fctr,Q120472.fctr,Q98197.fctr,Q113181.fctr,Q115611.fctr,Gender.fctr,Q109244.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
## max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1 25 25.391 2.535
## max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1 0.6756101 0.6287625 0.7224576 0.2521176
## opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1 0.45 0.7249263 0.6543941
## max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1 0.6508645 0.6788088 0.3044902
## max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1 0.5457838 0.4942748 0.5972927 0.4412078
## opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1 0.2 0.6941662 0.5345291
## max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1 0.5047442 0.5641315 0.01056316
## max.AccuracySD.fit max.KappaSD.fit
## 1 0.009303742 0.01932802
## [1] "myfit_mdl: exit: 37.101000 secs"
fit.models_0_chunk_df <-
myadd_chunk(fit.models_0_chunk_df, "fit.models_0_end", major.inc = FALSE,
label.minor = "teardown")
## label step_major step_minor label_minor bgn end
## 6 fit.models_0_Low.cor.X 1 5 glmnet 585.141 622.296
## 7 fit.models_0_end 1 6 teardown 622.297 NA
## elapsed
## 6 37.155
## 7 NA
rm(ret_lst)
glb_chunks_df <- myadd_chunk(glb_chunks_df, "fit.models", major.inc = FALSE)
## label step_major step_minor label_minor bgn end elapsed
## 16 fit.models 8 0 0 543.189 622.313 79.124
## 17 fit.models 8 1 1 622.314 NA NA
fit.models_1_chunk_df <- myadd_chunk(NULL, "fit.models_1_bgn", label.minor = "setup")
## label step_major step_minor label_minor bgn end elapsed
## 1 fit.models_1_bgn 1 0 setup 626.794 NA NA
# refactor code for outliers / ensure all model runs exclude outliers in this chunk ???
#stop(here"); glb2Sav(); all.equal(glb_models_df, sav_models_df)
topindep_var <- NULL; interact_vars <- NULL;
for (mdl_id_pfx in names(glbMdlFamilies)) {
fit.models_1_chunk_df <-
myadd_chunk(fit.models_1_chunk_df, paste0("fit.models_1_", mdl_id_pfx),
major.inc = FALSE, label.minor = "setup")
indepVar <- NULL;
if (grepl("\\.Interact", mdl_id_pfx)) {
if (is.null(topindep_var) && is.null(interact_vars)) {
# select best glmnet model upto now
dsp_models_df <- orderBy(model_sel_frmla <- get_model_sel_frmla(),
glb_models_df)
dsp_models_df <- subset(dsp_models_df,
grepl(".glmnet", id, fixed = TRUE))
bst_mdl_id <- dsp_models_df$id[1]
mdl_id_pfx <-
paste(c(head(unlist(strsplit(bst_mdl_id, "[.]")), -1), "Interact"),
collapse=".")
# select important features
if (is.null(bst_featsimp_df <-
myget_feats_importance(glb_models_lst[[bst_mdl_id]]))) {
warning("Base model for RFE.Interact: ", bst_mdl_id,
" has no important features")
next
}
topindep_ix <- 1
while (is.null(topindep_var) && (topindep_ix <= nrow(bst_featsimp_df))) {
topindep_var <- row.names(bst_featsimp_df)[topindep_ix]
if (grepl(".fctr", topindep_var, fixed=TRUE))
topindep_var <-
paste0(unlist(strsplit(topindep_var, ".fctr"))[1], ".fctr")
if (topindep_var %in% names(glbFeatsInteractionOnly)) {
topindep_var <- NULL; topindep_ix <- topindep_ix + 1
} else break
}
# select features with importance > max(10, importance of .rnorm) & is not highest
# combine factor dummy features to just the factor feature
if (length(pos_rnorm <-
grep(".rnorm", row.names(bst_featsimp_df), fixed=TRUE)) > 0)
imp_rnorm <- bst_featsimp_df[pos_rnorm, 1] else
imp_rnorm <- NA
imp_cutoff <- max(10, imp_rnorm, na.rm=TRUE)
interact_vars <-
tail(row.names(subset(bst_featsimp_df,
imp > imp_cutoff)), -1)
if (length(interact_vars) > 0) {
interact_vars <-
myadjustInteractionFeats(glb_feats_df, myextract_actual_feats(interact_vars))
interact_vars <-
interact_vars[!grepl(topindep_var, interact_vars, fixed=TRUE)]
}
### bid0_sp only
# interact_vars <- c(
# "biddable", "D.ratio.sum.TfIdf.wrds.n", "D.TfIdf.sum.stem.stop.Ratio", "D.sum.TfIdf",
# "D.TfIdf.sum.post.stop", "D.TfIdf.sum.post.stem", "D.ratio.wrds.stop.n.wrds.n", "D.chrs.uppr.n.log",
# "D.chrs.n.log", "color.fctr"
# # , "condition.fctr", "prdl.my.descr.fctr"
# )
# interact_vars <- setdiff(interact_vars, c("startprice.dgt2.is9", "color.fctr"))
###
indepVar <- myextract_actual_feats(row.names(bst_featsimp_df))
indepVar <- setdiff(indepVar, topindep_var)
if (length(interact_vars) > 0) {
indepVar <-
setdiff(indepVar, myextract_actual_feats(interact_vars))
indepVar <- c(indepVar,
paste(topindep_var, setdiff(interact_vars, topindep_var),
sep = "*"))
} else indepVar <- union(indepVar, topindep_var)
}
}
if (is.null(indepVar))
indepVar <- glb_mdl_feats_lst[[mdl_id_pfx]]
if (is.null(indepVar) && grepl("RFE\\.", mdl_id_pfx))
indepVar <- myextract_actual_feats(predictors(rfe_fit_results))
if (is.null(indepVar))
indepVar <- mygetIndepVar(glb_feats_df)
if ((length(indepVar) == 1) && (grepl("^%<d-%", indepVar))) {
indepVar <-
eval(parse(text = str_trim(unlist(strsplit(indepVar, "%<d-%"))[2])))
}
indepVar <- myadjustInteractionFeats(glb_feats_df, indepVar)
if (grepl("\\.Interact", mdl_id_pfx)) {
# if (method != tail(unlist(strsplit(bst_mdl_id, "[.]")), 1)) next
if (is.null(glbMdlFamilies[[mdl_id_pfx]])) {
if (!is.null(glbMdlFamilies[["Best.Interact"]]))
glbMdlFamilies[[mdl_id_pfx]] <-
glbMdlFamilies[["Best.Interact"]]
}
}
if (!is.null(glbObsFitOutliers[[mdl_id_pfx]])) {
fitobs_df <- glbObsFit[!(glbObsFit[, glbFeatsId] %in%
glbObsFitOutliers[[mdl_id_pfx]]), ]
print(sprintf("Outliers removed: %d", nrow(glbObsFit) - nrow(fitobs_df)))
print(setdiff(glbObsFit[, glbFeatsId], fitobs_df[, glbFeatsId]))
} else fitobs_df <- glbObsFit
if (is.null(glbMdlFamilies[[mdl_id_pfx]]))
mdl_methods <- glbMdlMethods else
mdl_methods <- glbMdlFamilies[[mdl_id_pfx]]
for (method in mdl_methods) {
if (method %in% c("rpart", "rf")) {
# rpart: fubar's the tree
# rf: skip the scenario w/ .rnorm for speed
indepVar <- setdiff(indepVar, c(".rnorm"))
#mdl_id <- paste0(mdl_id_pfx, ".no.rnorm")
}
fit.models_1_chunk_df <- myadd_chunk(fit.models_1_chunk_df,
paste0("fit.models_1_", mdl_id_pfx), major.inc = FALSE,
label.minor = method)
ret_lst <-
myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = mdl_id_pfx,
type = glb_model_type,
tune.df = glbMdlTuneParams,
trainControl.method = "repeatedcv", # or "none" if nominalWorkflow is crashing
trainControl.number = glb_rcv_n_folds,
trainControl.repeats = glb_rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
trainControl.allowParallel = glbMdlAllowParallel,
train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize,
train.method = method)),
indepVar = indepVar, rsp_var = glb_rsp_var,
fit_df = fitobs_df, OOB_df = glbObsOOB)
# ntv_mdl <- glmnet(x = as.matrix(
# fitobs_df[, indepVar]),
# y = as.factor(as.character(
# fitobs_df[, glb_rsp_var])),
# family = "multinomial")
# bgn = 1; end = 100;
# ntv_mdl <- glmnet(x = as.matrix(
# subset(fitobs_df, pop.fctr != "crypto")[bgn:end, indepVar]),
# y = as.factor(as.character(
# subset(fitobs_df, pop.fctr != "crypto")[bgn:end, glb_rsp_var])),
# family = "multinomial")
}
}
## label step_major step_minor label_minor bgn end
## 1 fit.models_1_bgn 1 0 setup 626.794 626.805
## 2 fit.models_1_All.X 1 1 setup 626.805 NA
## elapsed
## 1 0.011
## 2 NA
## label step_major step_minor label_minor bgn end
## 2 fit.models_1_All.X 1 1 setup 626.805 626.813
## 3 fit.models_1_All.X 1 2 glmnet 626.813 NA
## elapsed
## 2 0.008
## 3 NA
## [1] "myfit_mdl: enter: 0.000000 secs"
## [1] "fitting model: All.X##rcv#glmnet"
## [1] " indepVar: Q109244.fctr,Hhold.fctr,Edn.fctr,Q101163.fctr,Q100689.fctr,Q98078.fctr,Q99716.fctr,Q120379.fctr,Q121699.fctr,Q105840.fctr,Q113583.fctr,Q115195.fctr,Q102089.fctr,Q98059.fctr,Q114386.fctr,Q100680.fctr,Q108342.fctr,Q111848.fctr,YOB.Age.fctr,Q118892.fctr,Q102687.fctr,Q115390.fctr,Q119851.fctr,Q114517.fctr,Q120012.fctr,Q109367.fctr,Q114961.fctr,Q121700.fctr,Q124122.fctr,Q111220.fctr,Q113992.fctr,Q121011.fctr,Q106042.fctr,Q116448.fctr,Q116601.fctr,Q104996.fctr,Q102906.fctr,Q113584.fctr,Q108950.fctr,Q102674.fctr,Q103293.fctr,Q112478.fctr,Q114748.fctr,Q107491.fctr,Q100562.fctr,Q108617.fctr,Q100010.fctr,Q115602.fctr,Q116953.fctr,Q115610.fctr,Q106997.fctr,Q120978.fctr,Q112512.fctr,Q108343.fctr,Q96024.fctr,Q106389.fctr,.rnorm,Q108754.fctr,Q98578.fctr,Q101162.fctr,Q115777.fctr,Q99581.fctr,Q124742.fctr,Q116797.fctr,Q112270.fctr,Q118237.fctr,Q119650.fctr,Q111580.fctr,Q123464.fctr,Q117193.fctr,Q99982.fctr,Q108856.fctr,Q118233.fctr,Q102289.fctr,Q116197.fctr,Income.fctr,Q118232.fctr,Q120194.fctr,Q114152.fctr,Q122770.fctr,Q117186.fctr,Q105655.fctr,Q106993.fctr,Q119334.fctr,Q122120.fctr,Q116441.fctr,Q118117.fctr,Q123621.fctr,Q122769.fctr,Q120650.fctr,Q98869.fctr,Q107869.fctr,Q120014.fctr,Q115899.fctr,Q106388.fctr,Q99480.fctr,Q122771.fctr,Q108855.fctr,Q110740.fctr,Q106272.fctr,Q101596.fctr,Q116881.fctr,Q120472.fctr,Q98197.fctr,Q113181.fctr,Q115611.fctr,Gender.fctr,Q109244.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff"
## [1] "myfit_mdl: setup complete: 0.747000 secs"
## Aggregating results
## Selecting tuning parameters
## Fitting alpha = 0.1, lambda = 0.0652 on full training set
## [1] "myfit_mdl: train complete: 26.348000 secs"
## Warning in myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst
## = list(id.prefix = mdl_id_pfx, : model's bestTune found at an extreme of
## tuneGrid for parameter: alpha
## Warning in myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst
## = list(id.prefix = mdl_id_pfx, : model's bestTune found at an extreme of
## tuneGrid for parameter: lambda
## Length Class Mode
## a0 92 -none- numeric
## beta 22724 dgCMatrix S4
## df 92 -none- numeric
## dim 2 -none- numeric
## lambda 92 -none- numeric
## dev.ratio 92 -none- numeric
## nulldev 1 -none- numeric
## npasses 1 -none- numeric
## jerr 1 -none- numeric
## offset 1 -none- logical
## classnames 2 -none- character
## call 5 -none- call
## nobs 1 -none- numeric
## lambdaOpt 1 -none- numeric
## xNames 247 -none- character
## problemType 1 -none- character
## tuneValue 2 data.frame list
## obsLevels 2 -none- character
## [1] "min lambda > lambdaOpt:"
## (Intercept) .rnorm
## 0.2086644068 -0.0040676082
## Edn.fctr.L Edn.fctr^6
## 0.0807593733 0.0037049998
## Edn.fctr^7 Gender.fctrF
## 0.0109130085 0.0175273672
## Gender.fctrM Hhold.fctrMKy
## -0.0975008166 -0.0917112139
## Hhold.fctrPKn Hhold.fctrSKy
## 0.4801925403 0.0860632190
## Income.fctr.Q Income.fctr.C
## -0.1167443486 -0.0618266878
## Q100689.fctrYes Q101163.fctrDad
## 0.0916223483 -0.1174179957
## Q101163.fctrMom Q101596.fctrYes
## 0.0690167583 -0.0149916083
## Q102089.fctrRent Q102687.fctrYes
## 0.0397274885 0.0236799740
## Q104996.fctrNo Q104996.fctrYes
## -0.0384366155 0.0082970435
## Q105655.fctrYes Q105840.fctrNo
## -0.0103747720 -0.0108299455
## Q105840.fctrYes Q106042.fctrNo
## 0.0336072662 -0.0681056248
## Q106388.fctrYes Q106389.fctrNo
## -0.0222148609 -0.0341247333
## Q106997.fctrGr Q107869.fctrNo
## -0.0410948349 0.0062341950
## Q108342.fctrOnline Q108754.fctrYes
## 0.0482821727 -0.0332250858
## Q108855.fctrYes! Q108856.fctrSocialize
## -0.0244465573 -0.0298124454
## Q109244.fctrNo Q109244.fctrYes
## -0.4233306042 0.8673728628
## Q109367.fctrYes Q110740.fctrPC
## 0.0075309573 -0.0812633625
## Q111220.fctrNo Q111220.fctrYes
## -0.0028992659 0.0548562552
## Q111848.fctrYes Q112270.fctrNo
## 0.0422254964 0.0003926562
## Q112478.fctrNo Q113181.fctrNo
## -0.0287283353 0.1208500531
## Q113181.fctrYes Q113583.fctrTunes
## -0.1721653557 0.0191272307
## Q113992.fctrYes Q114517.fctrNo
## 0.0026477157 0.0298295402
## Q115195.fctrNo Q115195.fctrYes
## -0.0079655514 0.0274792793
## Q115390.fctrYes Q115610.fctrNo
## 0.0433150081 -0.0192191439
## Q115611.fctrNo Q115611.fctrYes
## 0.1197804457 -0.2812318027
## Q115899.fctrCs Q115899.fctrMe
## 0.0713773936 -0.0289640943
## Q116197.fctrA.M. Q116881.fctrHappy
## -0.0110939396 0.0144345169
## Q116881.fctrRight Q116953.fctrNo
## -0.1586375438 -0.0604468028
## Q118117.fctrYes Q118232.fctrId
## -0.0356424665 0.0967572276
## Q118233.fctrNo Q118892.fctrNo
## -0.0476696274 -0.0101337298
## Q119851.fctrNo Q119851.fctrYes
## -0.0747510956 0.0896931372
## Q120012.fctrYes Q120014.fctrNo
## 0.0266469396 0.0108260492
## Q120014.fctrYes Q120194.fctrStudy first
## -0.0071405452 0.0010046252
## Q120379.fctrNo Q120379.fctrYes
## -0.0230881465 0.0722805146
## Q120472.fctrScience Q120650.fctrNo
## -0.0777170361 0.0115894753
## Q121699.fctrYes Q122120.fctrYes
## 0.0566089666 -0.0707418237
## Q122771.fctrPt Q123621.fctrYes
## -0.0962320118 -0.0018081407
## Q124122.fctrNo Q124742.fctrNo
## -0.0088367827 0.0311087872
## Q98059.fctrOnly-child Q98059.fctrYes
## -0.0379123244 0.0373348517
## Q98197.fctrNo Q98197.fctrYes
## 0.1656648663 -0.1218575980
## Q98869.fctrNo Q99480.fctrNo
## 0.2533897602 0.1223858992
## Q99480.fctrYes Q99716.fctrYes
## -0.0522373638 0.0479268633
## YOB.Age.fctr.L YOB.Age.fctr^8
## 0.0939646970 -0.0340229370
## Q109244.fctrYes:.clusterid.fctr2 Q109244.fctrNo:.clusterid.fctr3
## 0.1462699802 -0.0267021748
## Q109244.fctrYes:.clusterid.fctr3 YOB.Age.fctr(30,35]:YOB.Age.dff
## 0.6434456849 -0.0054183207
## YOB.Age.fctr(35,40]:YOB.Age.dff YOB.Age.fctr(40,50]:YOB.Age.dff
## 0.0714364573 -0.0003430897
## [1] "max lambda < lambdaOpt:"
## (Intercept) .rnorm
## 0.2133116408 -0.0063580846
## Edn.fctr.L Edn.fctr^4
## 0.0855088630 -0.0006733155
## Edn.fctr^6 Edn.fctr^7
## 0.0104415796 0.0169153579
## Gender.fctrF Gender.fctrM
## 0.0120614113 -0.0998204566
## Hhold.fctrMKy Hhold.fctrPKn
## -0.0971229287 0.4982311801
## Hhold.fctrSKy Income.fctr.Q
## 0.0980579205 -0.1236872013
## Income.fctr.C Q100689.fctrYes
## -0.0721016259 0.0991483660
## Q101162.fctrPessimist Q101163.fctrDad
## -0.0021383985 -0.1222799255
## Q101163.fctrMom Q101596.fctrYes
## 0.0708708260 -0.0194907319
## Q102089.fctrRent Q102687.fctrYes
## 0.0430274966 0.0302665215
## Q102906.fctrYes Q104996.fctrNo
## -0.0053679772 -0.0428684755
## Q104996.fctrYes Q105655.fctrYes
## 0.0129695841 -0.0156314570
## Q105840.fctrNo Q105840.fctrYes
## -0.0087099928 0.0363178280
## Q106042.fctrNo Q106388.fctrYes
## -0.0714315958 -0.0258114314
## Q106389.fctrNo Q106997.fctrGr
## -0.0405401997 -0.0477850922
## Q107869.fctrNo Q108342.fctrOnline
## 0.0123815444 0.0541889369
## Q108754.fctrYes Q108855.fctrYes!
## -0.0395679490 -0.0286372736
## Q108856.fctrSocialize Q109244.fctrNo
## -0.0366184596 -0.4304273946
## Q109244.fctrYes Q109367.fctrYes
## 0.8859332171 0.0096264253
## Q110740.fctrMac Q110740.fctrPC
## 0.0016062166 -0.0871089509
## Q111220.fctrNo Q111220.fctrYes
## -0.0064779703 0.0602733531
## Q111848.fctrYes Q112270.fctrNo
## 0.0489308979 0.0041590948
## Q112478.fctrNo Q113181.fctrNo
## -0.0336132254 0.1222078279
## Q113181.fctrYes Q113583.fctrTunes
## -0.1769077838 0.0232944887
## Q113992.fctrYes Q114517.fctrNo
## 0.0093114211 0.0363977845
## Q115195.fctrNo Q115195.fctrYes
## -0.0117013636 0.0300167127
## Q115390.fctrYes Q115610.fctrNo
## 0.0493692970 -0.0264929967
## Q115611.fctrNo Q115611.fctrYes
## 0.1195966557 -0.2886833828
## Q115899.fctrCs Q115899.fctrMe
## 0.0767471002 -0.0310474147
## Q116197.fctrA.M. Q116881.fctrHappy
## -0.0178577032 0.0186990229
## Q116881.fctrRight Q116953.fctrNo
## -0.1627119311 -0.0678083129
## Q118117.fctrYes Q118232.fctrId
## -0.0384748338 0.1049607291
## Q118233.fctrNo Q118892.fctrNo
## -0.0551602210 -0.0116647542
## Q119851.fctrNo Q119851.fctrYes
## -0.0785778058 0.0939051159
## Q120012.fctrYes Q120014.fctrNo
## 0.0314354375 0.0133418508
## Q120014.fctrYes Q120194.fctrStudy first
## -0.0095710830 0.0046369879
## Q120379.fctrNo Q120379.fctrYes
## -0.0264476527 0.0781396918
## Q120472.fctrScience Q120650.fctrNo
## -0.0831398605 0.0214397919
## Q121011.fctrNo Q121011.fctrYes
## -0.0006193183 0.0007349370
## Q121699.fctrYes Q122120.fctrYes
## 0.0621928559 -0.0787327327
## Q122771.fctrPt Q123621.fctrYes
## -0.1051539163 -0.0071296472
## Q124122.fctrNo Q124742.fctrNo
## -0.0139014911 0.0398117762
## Q96024.fctrNo Q98059.fctrOnly-child
## 0.0042966064 -0.0512494295
## Q98059.fctrYes Q98197.fctrNo
## 0.0448973136 0.1689994948
## Q98197.fctrYes Q98869.fctrNo
## -0.1250279025 0.2630244707
## Q99480.fctrNo Q99480.fctrYes
## 0.1266614399 -0.0591442546
## Q99716.fctrYes YOB.Age.fctr.L
## 0.0505441934 0.1052236239
## YOB.Age.fctr.Q YOB.Age.fctr^8
## 0.0055981032 -0.0341534347
## Q109244.fctrYes:.clusterid.fctr2 Q109244.fctrNo:.clusterid.fctr3
## 0.1463559578 -0.0262516542
## Q109244.fctrYes:.clusterid.fctr3 YOB.Age.fctr(30,35]:YOB.Age.dff
## 0.6643435951 -0.0080024138
## YOB.Age.fctr(35,40]:YOB.Age.dff YOB.Age.fctr(40,50]:YOB.Age.dff
## 0.0754472783 -0.0017757125
## [1] "myfit_mdl: train diagnostics complete: 27.229000 secs"
## Prediction
## Reference R D
## R 995 1098
## D 394 1966
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 6.649450e-01 3.144277e-01 6.508645e-01 6.788088e-01 5.299798e-01
## AccuracyPValue McnemarPValue
## 1.133086e-74 5.162652e-74
## Prediction
## Reference R D
## R 7 517
## D 2 589
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 5.345291e-01 1.056316e-02 5.047442e-01 5.641315e-01 5.300448e-01
## AccuracyPValue McnemarPValue
## 3.937954e-01 1.021659e-112
## [1] "myfit_mdl: predict complete: 38.655000 secs"
## id
## 1 All.X##rcv#glmnet
## feats
## 1 Q109244.fctr,Hhold.fctr,Edn.fctr,Q101163.fctr,Q100689.fctr,Q98078.fctr,Q99716.fctr,Q120379.fctr,Q121699.fctr,Q105840.fctr,Q113583.fctr,Q115195.fctr,Q102089.fctr,Q98059.fctr,Q114386.fctr,Q100680.fctr,Q108342.fctr,Q111848.fctr,YOB.Age.fctr,Q118892.fctr,Q102687.fctr,Q115390.fctr,Q119851.fctr,Q114517.fctr,Q120012.fctr,Q109367.fctr,Q114961.fctr,Q121700.fctr,Q124122.fctr,Q111220.fctr,Q113992.fctr,Q121011.fctr,Q106042.fctr,Q116448.fctr,Q116601.fctr,Q104996.fctr,Q102906.fctr,Q113584.fctr,Q108950.fctr,Q102674.fctr,Q103293.fctr,Q112478.fctr,Q114748.fctr,Q107491.fctr,Q100562.fctr,Q108617.fctr,Q100010.fctr,Q115602.fctr,Q116953.fctr,Q115610.fctr,Q106997.fctr,Q120978.fctr,Q112512.fctr,Q108343.fctr,Q96024.fctr,Q106389.fctr,.rnorm,Q108754.fctr,Q98578.fctr,Q101162.fctr,Q115777.fctr,Q99581.fctr,Q124742.fctr,Q116797.fctr,Q112270.fctr,Q118237.fctr,Q119650.fctr,Q111580.fctr,Q123464.fctr,Q117193.fctr,Q99982.fctr,Q108856.fctr,Q118233.fctr,Q102289.fctr,Q116197.fctr,Income.fctr,Q118232.fctr,Q120194.fctr,Q114152.fctr,Q122770.fctr,Q117186.fctr,Q105655.fctr,Q106993.fctr,Q119334.fctr,Q122120.fctr,Q116441.fctr,Q118117.fctr,Q123621.fctr,Q122769.fctr,Q120650.fctr,Q98869.fctr,Q107869.fctr,Q120014.fctr,Q115899.fctr,Q106388.fctr,Q99480.fctr,Q122771.fctr,Q108855.fctr,Q110740.fctr,Q106272.fctr,Q101596.fctr,Q116881.fctr,Q120472.fctr,Q98197.fctr,Q113181.fctr,Q115611.fctr,Gender.fctr,Q109244.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
## max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1 25 25.483 2.849
## max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1 0.6756101 0.6287625 0.7224576 0.2521176
## opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1 0.45 0.7249263 0.6543941
## max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1 0.6508645 0.6788088 0.3044902
## max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1 0.5457838 0.4942748 0.5972927 0.4412078
## opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1 0.2 0.6941662 0.5345291
## max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1 0.5047442 0.5641315 0.01056316
## max.AccuracySD.fit max.KappaSD.fit
## 1 0.009303742 0.01932802
## [1] "myfit_mdl: exit: 38.672000 secs"
## label step_major step_minor label_minor bgn end
## 3 fit.models_1_All.X 1 2 glmnet 626.813 665.49
## 4 fit.models_1_All.X 1 3 glm 665.490 NA
## elapsed
## 3 38.677
## 4 NA
## [1] "myfit_mdl: enter: 0.001000 secs"
## [1] "fitting model: All.X##rcv#glm"
## [1] " indepVar: Q109244.fctr,Hhold.fctr,Edn.fctr,Q101163.fctr,Q100689.fctr,Q98078.fctr,Q99716.fctr,Q120379.fctr,Q121699.fctr,Q105840.fctr,Q113583.fctr,Q115195.fctr,Q102089.fctr,Q98059.fctr,Q114386.fctr,Q100680.fctr,Q108342.fctr,Q111848.fctr,YOB.Age.fctr,Q118892.fctr,Q102687.fctr,Q115390.fctr,Q119851.fctr,Q114517.fctr,Q120012.fctr,Q109367.fctr,Q114961.fctr,Q121700.fctr,Q124122.fctr,Q111220.fctr,Q113992.fctr,Q121011.fctr,Q106042.fctr,Q116448.fctr,Q116601.fctr,Q104996.fctr,Q102906.fctr,Q113584.fctr,Q108950.fctr,Q102674.fctr,Q103293.fctr,Q112478.fctr,Q114748.fctr,Q107491.fctr,Q100562.fctr,Q108617.fctr,Q100010.fctr,Q115602.fctr,Q116953.fctr,Q115610.fctr,Q106997.fctr,Q120978.fctr,Q112512.fctr,Q108343.fctr,Q96024.fctr,Q106389.fctr,.rnorm,Q108754.fctr,Q98578.fctr,Q101162.fctr,Q115777.fctr,Q99581.fctr,Q124742.fctr,Q116797.fctr,Q112270.fctr,Q118237.fctr,Q119650.fctr,Q111580.fctr,Q123464.fctr,Q117193.fctr,Q99982.fctr,Q108856.fctr,Q118233.fctr,Q102289.fctr,Q116197.fctr,Income.fctr,Q118232.fctr,Q120194.fctr,Q114152.fctr,Q122770.fctr,Q117186.fctr,Q105655.fctr,Q106993.fctr,Q119334.fctr,Q122120.fctr,Q116441.fctr,Q118117.fctr,Q123621.fctr,Q122769.fctr,Q120650.fctr,Q98869.fctr,Q107869.fctr,Q120014.fctr,Q115899.fctr,Q106388.fctr,Q99480.fctr,Q122771.fctr,Q108855.fctr,Q110740.fctr,Q106272.fctr,Q101596.fctr,Q116881.fctr,Q120472.fctr,Q98197.fctr,Q113181.fctr,Q115611.fctr,Gender.fctr,Q109244.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff"
## [1] "myfit_mdl: setup complete: 0.749000 secs"
## + Fold1.Rep1: parameter=none
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## - Fold1.Rep1: parameter=none
## + Fold2.Rep1: parameter=none
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## - Fold2.Rep1: parameter=none
## + Fold3.Rep1: parameter=none
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## - Fold3.Rep1: parameter=none
## + Fold1.Rep2: parameter=none
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## - Fold1.Rep2: parameter=none
## + Fold2.Rep2: parameter=none
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## - Fold2.Rep2: parameter=none
## + Fold3.Rep2: parameter=none
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## - Fold3.Rep2: parameter=none
## + Fold1.Rep3: parameter=none
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## - Fold1.Rep3: parameter=none
## + Fold2.Rep3: parameter=none
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## - Fold2.Rep3: parameter=none
## + Fold3.Rep3: parameter=none
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## - Fold3.Rep3: parameter=none
## Aggregating results
## Fitting final model on full training set
## [1] "myfit_mdl: train complete: 17.819000 secs"
##
## Call:
## NULL
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.7825 -0.9884 0.3117 1.0023 2.4698
##
## Coefficients: (1 not defined because of singularities)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.3723014 0.2743109 1.357 0.174710
## .rnorm -0.0286052 0.0349117 -0.819 0.412582
## Edn.fctr.L 0.0985627 0.1633504 0.603 0.546254
## Edn.fctr.Q 0.0130760 0.1521658 0.086 0.931520
## Edn.fctr.C -0.0202094 0.1321997 -0.153 0.878501
## `Edn.fctr^4` -0.2308816 0.1306417 -1.767 0.077180
## `Edn.fctr^5` -0.0765148 0.1191541 -0.642 0.520776
## `Edn.fctr^6` 0.1025080 0.1080930 0.948 0.342960
## `Edn.fctr^7` 0.1458858 0.1179547 1.237 0.216163
## Gender.fctrF -0.3087778 0.2425941 -1.273 0.203083
## Gender.fctrM -0.4113330 0.2384298 -1.725 0.084496
## Hhold.fctrMKn 0.0879145 0.1870045 0.470 0.638270
## Hhold.fctrMKy -0.0682443 0.1737064 -0.393 0.694414
## Hhold.fctrPKn 0.9763650 0.2667766 3.660 0.000252
## Hhold.fctrPKy 0.0975484 0.3494170 0.279 0.780111
## Hhold.fctrSKn 0.1701501 0.1477453 1.152 0.249467
## Hhold.fctrSKy 0.4028729 0.2453409 1.642 0.100571
## Income.fctr.L -0.1400329 0.1116010 -1.255 0.209564
## Income.fctr.Q -0.2633172 0.1026337 -2.566 0.010300
## Income.fctr.C -0.2075449 0.1003758 -2.068 0.038670
## `Income.fctr^4` -0.0127832 0.0971606 -0.132 0.895326
## `Income.fctr^5` -0.0438713 0.0981143 -0.447 0.654771
## `Income.fctr^6` 0.0397277 0.0956967 0.415 0.678038
## Q100010.fctrNo 0.2312456 0.2235669 1.034 0.300974
## Q100010.fctrYes 0.1526087 0.2024784 0.754 0.451027
## Q100562.fctrNo 0.0672470 0.2060115 0.326 0.744104
## Q100562.fctrYes 0.0813385 0.1801475 0.452 0.651621
## Q100680.fctrNo -0.2045210 0.1999743 -1.023 0.306432
## Q100680.fctrYes -0.3597218 0.1938855 -1.855 0.063549
## Q100689.fctrNo 0.1974410 0.1955822 1.010 0.312733
## Q100689.fctrYes 0.4226992 0.1941309 2.177 0.029451
## Q101162.fctrOptimist 0.0267730 0.1867213 0.143 0.885986
## Q101162.fctrPessimist -0.0421402 0.1930407 -0.218 0.827198
## Q101163.fctrDad -0.1783596 0.1660281 -1.074 0.282700
## Q101163.fctrMom 0.1342041 0.1701343 0.789 0.430222
## Q101596.fctrNo -0.3697894 0.1663576 -2.223 0.026225
## Q101596.fctrYes -0.4344366 0.1761110 -2.467 0.013631
## Q102089.fctrOwn 0.1266299 0.1673605 0.757 0.449272
## Q102089.fctrRent 0.2064186 0.1788390 1.154 0.248412
## Q102289.fctrNo -0.1554282 0.1722254 -0.902 0.366807
## Q102289.fctrYes -0.1333310 0.1815645 -0.734 0.462739
## Q102674.fctrNo -0.2836154 0.2235376 -1.269 0.204527
## Q102674.fctrYes -0.2002714 0.2352849 -0.851 0.394665
## Q102687.fctrNo 0.6702270 0.2347735 2.855 0.004307
## Q102687.fctrYes 0.7015527 0.2327776 3.014 0.002580
## Q102906.fctrNo -0.1489412 0.1733926 -0.859 0.390350
## Q102906.fctrYes -0.2923697 0.1784918 -1.638 0.101422
## Q103293.fctrNo -0.0184636 0.1531788 -0.121 0.904058
## Q103293.fctrYes 0.0611077 0.1553566 0.393 0.694069
## Q104996.fctrNo -0.0865822 0.1479975 -0.585 0.558531
## Q104996.fctrYes 0.1408414 0.1437326 0.980 0.327143
## Q105655.fctrNo 0.0393229 0.1751382 0.225 0.822349
## Q105655.fctrYes -0.0317297 0.1716918 -0.185 0.853381
## Q105840.fctrNo 0.0394769 0.1759262 0.224 0.822450
## Q105840.fctrYes 0.1042617 0.1795366 0.581 0.561424
## Q106042.fctrNo -0.2263157 0.1795163 -1.261 0.207418
## Q106042.fctrYes -0.0842214 0.1773633 -0.475 0.634892
## Q106272.fctrNo -0.0779544 0.2024564 -0.385 0.700206
## Q106272.fctrYes 0.0001986 0.1870315 0.001 0.999153
## Q106388.fctrNo -0.0421581 0.2215132 -0.190 0.849060
## Q106388.fctrYes -0.1345873 0.2343704 -0.574 0.565798
## Q106389.fctrNo -0.1638502 0.2151173 -0.762 0.446252
## Q106389.fctrYes -0.0102729 0.2172068 -0.047 0.962278
## Q106993.fctrNo -0.2151087 0.2222230 -0.968 0.333052
## Q106993.fctrYes -0.1751557 0.1949384 -0.899 0.368909
## Q106997.fctrGr -0.0494462 0.1937388 -0.255 0.798552
## Q106997.fctrYy 0.1134361 0.1972839 0.575 0.565299
## Q107491.fctrNo 0.0663198 0.1844610 0.360 0.719196
## Q107491.fctrYes 0.0848637 0.1425052 0.596 0.551500
## Q107869.fctrNo 0.1263039 0.1482277 0.852 0.394162
## Q107869.fctrYes 0.0060443 0.1485354 0.041 0.967541
## `Q108342.fctrIn-person` 0.1212505 0.1829007 0.663 0.507375
## Q108342.fctrOnline 0.2831233 0.1942951 1.457 0.145066
## Q108343.fctrNo 0.0228377 0.1885985 0.121 0.903618
## Q108343.fctrYes -0.0004957 0.1996496 -0.002 0.998019
## Q108617.fctrNo 0.0633730 0.1679607 0.377 0.705944
## Q108617.fctrYes -0.0978360 0.2088115 -0.469 0.639401
## Q108754.fctrNo -0.1587494 0.1858249 -0.854 0.392941
## Q108754.fctrYes -0.3248918 0.1960087 -1.658 0.097411
## Q108855.fctrUmm... -0.1437799 0.2163074 -0.665 0.506241
## `Q108855.fctrYes!` -0.2336491 0.2140754 -1.091 0.275082
## Q108856.fctrSocialize -0.0727570 0.2209667 -0.329 0.741954
## Q108856.fctrSpace 0.0896414 0.2061366 0.435 0.663661
## Q108950.fctrCautious 0.0944862 0.1574949 0.600 0.548552
## `Q108950.fctrRisk-friendly` 0.1639293 0.1695453 0.967 0.333606
## Q109244.fctrNo -0.5680465 0.1747898 -3.250 0.001155
## Q109244.fctrYes 1.2342832 0.2291888 5.385 7.23e-08
## Q109367.fctrNo 0.0920812 0.1566567 0.588 0.556673
## Q109367.fctrYes 0.0609232 0.1483936 0.411 0.681401
## Q110740.fctrMac 0.0126216 0.1330254 0.095 0.924409
## Q110740.fctrPC -0.2142621 0.1287568 -1.664 0.096096
## Q111220.fctrNo -0.1015575 0.1419852 -0.715 0.474444
## Q111220.fctrYes 0.1208931 0.1557005 0.776 0.437486
## Q111580.fctrDemanding -0.0929331 0.1585741 -0.586 0.557839
## Q111580.fctrSupportive -0.0893769 0.1474076 -0.606 0.544299
## Q111848.fctrNo 0.0846382 0.1549832 0.546 0.584989
## Q111848.fctrYes 0.2294112 0.1507724 1.522 0.128116
## Q112270.fctrNo 0.2960184 0.1511518 1.958 0.050181
## Q112270.fctrYes 0.2906046 0.1518481 1.914 0.055648
## Q112478.fctrNo -0.4127295 0.1786125 -2.311 0.020846
## Q112478.fctrYes -0.2352394 0.1720050 -1.368 0.171427
## Q112512.fctrNo 0.2489977 0.1901402 1.310 0.190349
## Q112512.fctrYes 0.1408247 0.1620600 0.869 0.384866
## Q113181.fctrNo 0.1028906 0.1496809 0.687 0.491831
## Q113181.fctrYes -0.3470875 0.1686489 -2.058 0.039586
## Q113583.fctrTalk 0.0292112 0.2074501 0.141 0.888019
## Q113583.fctrTunes 0.1296826 0.1991538 0.651 0.514938
## Q113584.fctrPeople 0.0296712 0.2058330 0.144 0.885381
## Q113584.fctrTechnology -0.0221105 0.2040691 -0.108 0.913719
## Q113992.fctrNo 0.0998254 0.1562504 0.639 0.522901
## Q113992.fctrYes 0.2227526 0.1669261 1.334 0.182060
## Q114152.fctrNo -0.2146140 0.1521567 -1.410 0.158398
## Q114152.fctrYes -0.1619124 0.1652040 -0.980 0.327049
## Q114386.fctrMysterious -0.0435419 0.1557019 -0.280 0.779747
## Q114386.fctrTMI -0.0177061 0.1594393 -0.111 0.911575
## Q114517.fctrNo 0.3451220 0.1720497 2.006 0.044862
## Q114517.fctrYes 0.2061939 0.1834118 1.124 0.260923
## Q114748.fctrNo -0.1143311 0.1808883 -0.632 0.527352
## Q114748.fctrYes -0.0710245 0.1794074 -0.396 0.692191
## Q114961.fctrNo -0.0010303 0.1696350 -0.006 0.995154
## Q114961.fctrYes -0.0194675 0.1681948 -0.116 0.907856
## Q115195.fctrNo -0.0999245 0.1691096 -0.591 0.554597
## Q115195.fctrYes 0.0427095 0.1578212 0.271 0.786684
## Q115390.fctrNo 0.0714397 0.1561520 0.458 0.647311
## Q115390.fctrYes 0.1992832 0.1459080 1.366 0.171997
## Q115602.fctrNo 0.1580882 0.1993292 0.793 0.427719
## Q115602.fctrYes 0.1109787 0.1775871 0.625 0.532020
## Q115610.fctrNo -0.0990375 0.2133534 -0.464 0.642508
## Q115610.fctrYes 0.0138276 0.1875631 0.074 0.941231
## Q115611.fctrNo -0.0399153 0.1991552 -0.200 0.841150
## Q115611.fctrYes -0.6457701 0.2178442 -2.964 0.003033
## Q115777.fctrEnd -0.0196891 0.1690397 -0.116 0.907275
## Q115777.fctrStart -0.0128621 0.1658396 -0.078 0.938180
## Q115899.fctrCs 0.2380355 0.1669155 1.426 0.153844
## Q115899.fctrMe -0.0111621 0.1632786 -0.068 0.945497
## Q116197.fctrA.M. -0.3548241 0.1624612 -2.184 0.028958
## Q116197.fctrP.M. -0.2759112 0.1500380 -1.839 0.065924
## Q116441.fctrNo 0.0606357 0.1830921 0.331 0.740512
## Q116441.fctrYes 0.0290950 0.1957778 0.149 0.881859
## Q116448.fctrNo 0.1560565 0.1741183 0.896 0.370110
## Q116448.fctrYes 0.1261541 0.1751618 0.720 0.471393
## Q116601.fctrNo 0.1213403 0.1988909 0.610 0.541806
## Q116601.fctrYes 0.0386659 0.1683992 0.230 0.818396
## Q116797.fctrNo -0.0872127 0.1686116 -0.517 0.604988
## Q116797.fctrYes -0.0796085 0.1744523 -0.456 0.648150
## Q116881.fctrHappy 0.1016727 0.1668274 0.609 0.542227
## Q116881.fctrRight -0.2085249 0.1817961 -1.147 0.251371
## Q116953.fctrNo -0.2543008 0.1786702 -1.423 0.154650
## Q116953.fctrYes -0.0405844 0.1673584 -0.243 0.808393
## `Q117186.fctrCool headed` 0.1307129 0.1664865 0.785 0.432380
## `Q117186.fctrHot headed` 0.0496470 0.1752766 0.283 0.776985
## `Q117193.fctrOdd hours` 0.0465203 0.1599644 0.291 0.771192
## `Q117193.fctrStandard hours` 0.0046209 0.1536010 0.030 0.976000
## Q118117.fctrNo 0.0739225 0.1520323 0.486 0.626805
## Q118117.fctrYes 0.0171292 0.1531924 0.112 0.910970
## Q118232.fctrId 0.4910151 0.1532265 3.205 0.001353
## Q118232.fctrPr 0.2994991 0.1517097 1.974 0.048364
## Q118233.fctrNo -0.2525656 0.1880588 -1.343 0.179267
## Q118233.fctrYes -0.0613658 0.2034092 -0.302 0.762891
## Q118237.fctrNo -0.2993260 0.1905373 -1.571 0.116193
## Q118237.fctrYes -0.2893921 0.1866475 -1.550 0.121028
## Q118892.fctrNo -0.0284457 0.1371565 -0.207 0.835701
## Q118892.fctrYes -0.0093389 0.1300110 -0.072 0.942736
## Q119334.fctrNo -0.0620298 0.1418201 -0.437 0.661833
## Q119334.fctrYes -0.0655649 0.1376821 -0.476 0.633928
## Q119650.fctrGiving -0.0445733 0.1470993 -0.303 0.761878
## Q119650.fctrReceiving 0.0724974 0.1634648 0.444 0.657401
## Q119851.fctrNo -0.1237893 0.1657486 -0.747 0.455154
## Q119851.fctrYes 0.1407361 0.1672704 0.841 0.400141
## Q120012.fctrNo 0.0839727 0.1705245 0.492 0.622410
## Q120012.fctrYes 0.2080306 0.1674678 1.242 0.214158
## Q120014.fctrNo -0.0733774 0.1588194 -0.462 0.644069
## Q120014.fctrYes -0.1716354 0.1512326 -1.135 0.256413
## `Q120194.fctrStudy first` 0.1716534 0.1454797 1.180 0.238035
## `Q120194.fctrTry first` 0.1082850 0.1498747 0.723 0.469985
## Q120379.fctrNo -0.0435016 0.1574968 -0.276 0.782389
## Q120379.fctrYes 0.1564713 0.1569465 0.997 0.318778
## Q120472.fctrArt -0.1187438 0.1676627 -0.708 0.478802
## Q120472.fctrScience -0.2744543 0.1574842 -1.743 0.081379
## Q120650.fctrNo 0.1883031 0.2045090 0.921 0.357177
## Q120650.fctrYes 0.0276007 0.1487570 0.186 0.852804
## Q120978.fctrNo 0.0121562 0.1594333 0.076 0.939223
## Q120978.fctrYes 0.0762389 0.1568159 0.486 0.626848
## Q121011.fctrNo -0.0605044 0.1611667 -0.375 0.707352
## Q121011.fctrYes -0.0063777 0.1582618 -0.040 0.967855
## Q121699.fctrNo 0.6586164 0.2481370 2.654 0.007949
## Q121699.fctrYes 0.7328396 0.2409607 3.041 0.002355
## Q121700.fctrNo -0.4467400 0.2414582 -1.850 0.064288
## Q121700.fctrYes -0.3947222 0.2628896 -1.501 0.133233
## Q122120.fctrNo -0.0753556 0.1403083 -0.537 0.591218
## Q122120.fctrYes -0.2579328 0.1567124 -1.646 0.099785
## Q122769.fctrNo 0.0316100 0.2160815 0.146 0.883694
## Q122769.fctrYes -0.0137242 0.2188633 -0.063 0.950000
## Q122770.fctrNo 0.2857630 0.2663406 1.073 0.283306
## Q122770.fctrYes 0.2907369 0.2628852 1.106 0.268750
## Q122771.fctrPc -0.3583886 0.2415305 -1.484 0.137856
## Q122771.fctrPt -0.5864723 0.2553726 -2.297 0.021645
## Q123464.fctrNo -0.0535807 0.1635098 -0.328 0.743145
## Q123464.fctrYes -0.0139769 0.2389368 -0.058 0.953353
## Q123621.fctrNo -0.0508450 0.1688843 -0.301 0.763365
## Q123621.fctrYes -0.1182399 0.1724119 -0.686 0.492840
## Q124122.fctrNo -0.0656451 0.1385977 -0.474 0.635758
## Q124122.fctrYes 0.0753886 0.1328120 0.568 0.570283
## Q124742.fctrNo 0.1737470 0.1091684 1.592 0.111486
## Q124742.fctrYes -0.0179177 0.1256906 -0.143 0.886642
## Q96024.fctrNo 0.1308852 0.1343652 0.974 0.330007
## Q96024.fctrYes 0.0742644 0.1275331 0.582 0.560354
## `Q98059.fctrOnly-child` -0.2671584 0.2612432 -1.023 0.306477
## Q98059.fctrYes 0.0826546 0.2167910 0.381 0.703007
## Q98078.fctrNo 0.3250054 0.2001128 1.624 0.104352
## Q98078.fctrYes 0.1742243 0.2024337 0.861 0.389432
## Q98197.fctrNo 0.2460544 0.1922093 1.280 0.200497
## Q98197.fctrYes -0.1363387 0.2001017 -0.681 0.495652
## Q98578.fctrNo -0.3977797 0.1577531 -2.522 0.011684
## Q98578.fctrYes -0.4192867 0.1653082 -2.536 0.011200
## Q98869.fctrNo 0.5576256 0.1755462 3.177 0.001491
## Q98869.fctrYes 0.1549404 0.1488415 1.041 0.297887
## Q99480.fctrNo 0.2002156 0.2101150 0.953 0.340648
## Q99480.fctrYes -0.2015865 0.1916501 -1.052 0.292870
## Q99581.fctrNo -0.3712421 0.2100957 -1.767 0.077226
## Q99581.fctrYes -0.3762595 0.2379134 -1.581 0.113764
## Q99716.fctrNo 0.3946387 0.1806821 2.184 0.028951
## Q99716.fctrYes 0.4286419 0.2336276 1.835 0.066547
## `Q99982.fctrCheck!` -0.0464410 0.1970671 -0.236 0.813696
## Q99982.fctrNope 0.0211061 0.1998026 0.106 0.915872
## YOB.Age.fctr.L 0.6937840 0.2764043 2.510 0.012072
## YOB.Age.fctr.Q 0.2890428 0.2423992 1.192 0.233095
## YOB.Age.fctr.C -0.0440515 0.2301362 -0.191 0.848201
## `YOB.Age.fctr^4` 0.2973679 0.2548075 1.167 0.243198
## `YOB.Age.fctr^5` -0.4408945 0.2568712 -1.716 0.086088
## `YOB.Age.fctr^6` 0.4230358 0.2296110 1.842 0.065416
## `YOB.Age.fctr^7` 0.0681762 0.2243488 0.304 0.761216
## `YOB.Age.fctr^8` -0.1109876 0.2401561 -0.462 0.643975
## `Q109244.fctrNA:.clusterid.fctr2` -0.0413216 0.1486479 -0.278 0.781025
## `Q109244.fctrNo:.clusterid.fctr2` -0.1775712 0.1707870 -1.040 0.298469
## `Q109244.fctrYes:.clusterid.fctr2` -0.0634738 0.2786851 -0.228 0.819831
## `Q109244.fctrNA:.clusterid.fctr3` 0.0381515 0.1730194 0.221 0.825479
## `Q109244.fctrNo:.clusterid.fctr3` -0.0422342 0.1639715 -0.258 0.796738
## `Q109244.fctrYes:.clusterid.fctr3` 1.0392558 0.3484167 2.983 0.002856
## `YOB.Age.fctrNA:YOB.Age.dff` NA NA NA NA
## `YOB.Age.fctr(15,20]:YOB.Age.dff` 0.1370915 0.0804097 1.705 0.088211
## `YOB.Age.fctr(20,25]:YOB.Age.dff` -0.0153582 0.0647779 -0.237 0.812587
## `YOB.Age.fctr(25,30]:YOB.Age.dff` -0.0805756 0.0702158 -1.148 0.251158
## `YOB.Age.fctr(30,35]:YOB.Age.dff` -0.0006165 0.0755944 -0.008 0.993493
## `YOB.Age.fctr(35,40]:YOB.Age.dff` 0.1731442 0.0815212 2.124 0.033677
## `YOB.Age.fctr(40,50]:YOB.Age.dff` -0.0466769 0.0326324 -1.430 0.152606
## `YOB.Age.fctr(50,65]:YOB.Age.dff` -0.0045074 0.0245852 -0.183 0.854534
## `YOB.Age.fctr(65,90]:YOB.Age.dff` -0.0389491 0.0346859 -1.123 0.261477
##
## (Intercept)
## .rnorm
## Edn.fctr.L
## Edn.fctr.Q
## Edn.fctr.C
## `Edn.fctr^4` .
## `Edn.fctr^5`
## `Edn.fctr^6`
## `Edn.fctr^7`
## Gender.fctrF
## Gender.fctrM .
## Hhold.fctrMKn
## Hhold.fctrMKy
## Hhold.fctrPKn ***
## Hhold.fctrPKy
## Hhold.fctrSKn
## Hhold.fctrSKy
## Income.fctr.L
## Income.fctr.Q *
## Income.fctr.C *
## `Income.fctr^4`
## `Income.fctr^5`
## `Income.fctr^6`
## Q100010.fctrNo
## Q100010.fctrYes
## Q100562.fctrNo
## Q100562.fctrYes
## Q100680.fctrNo
## Q100680.fctrYes .
## Q100689.fctrNo
## Q100689.fctrYes *
## Q101162.fctrOptimist
## Q101162.fctrPessimist
## Q101163.fctrDad
## Q101163.fctrMom
## Q101596.fctrNo *
## Q101596.fctrYes *
## Q102089.fctrOwn
## Q102089.fctrRent
## Q102289.fctrNo
## Q102289.fctrYes
## Q102674.fctrNo
## Q102674.fctrYes
## Q102687.fctrNo **
## Q102687.fctrYes **
## Q102906.fctrNo
## Q102906.fctrYes
## Q103293.fctrNo
## Q103293.fctrYes
## Q104996.fctrNo
## Q104996.fctrYes
## Q105655.fctrNo
## Q105655.fctrYes
## Q105840.fctrNo
## Q105840.fctrYes
## Q106042.fctrNo
## Q106042.fctrYes
## Q106272.fctrNo
## Q106272.fctrYes
## Q106388.fctrNo
## Q106388.fctrYes
## Q106389.fctrNo
## Q106389.fctrYes
## Q106993.fctrNo
## Q106993.fctrYes
## Q106997.fctrGr
## Q106997.fctrYy
## Q107491.fctrNo
## Q107491.fctrYes
## Q107869.fctrNo
## Q107869.fctrYes
## `Q108342.fctrIn-person`
## Q108342.fctrOnline
## Q108343.fctrNo
## Q108343.fctrYes
## Q108617.fctrNo
## Q108617.fctrYes
## Q108754.fctrNo
## Q108754.fctrYes .
## Q108855.fctrUmm...
## `Q108855.fctrYes!`
## Q108856.fctrSocialize
## Q108856.fctrSpace
## Q108950.fctrCautious
## `Q108950.fctrRisk-friendly`
## Q109244.fctrNo **
## Q109244.fctrYes ***
## Q109367.fctrNo
## Q109367.fctrYes
## Q110740.fctrMac
## Q110740.fctrPC .
## Q111220.fctrNo
## Q111220.fctrYes
## Q111580.fctrDemanding
## Q111580.fctrSupportive
## Q111848.fctrNo
## Q111848.fctrYes
## Q112270.fctrNo .
## Q112270.fctrYes .
## Q112478.fctrNo *
## Q112478.fctrYes
## Q112512.fctrNo
## Q112512.fctrYes
## Q113181.fctrNo
## Q113181.fctrYes *
## Q113583.fctrTalk
## Q113583.fctrTunes
## Q113584.fctrPeople
## Q113584.fctrTechnology
## Q113992.fctrNo
## Q113992.fctrYes
## Q114152.fctrNo
## Q114152.fctrYes
## Q114386.fctrMysterious
## Q114386.fctrTMI
## Q114517.fctrNo *
## Q114517.fctrYes
## Q114748.fctrNo
## Q114748.fctrYes
## Q114961.fctrNo
## Q114961.fctrYes
## Q115195.fctrNo
## Q115195.fctrYes
## Q115390.fctrNo
## Q115390.fctrYes
## Q115602.fctrNo
## Q115602.fctrYes
## Q115610.fctrNo
## Q115610.fctrYes
## Q115611.fctrNo
## Q115611.fctrYes **
## Q115777.fctrEnd
## Q115777.fctrStart
## Q115899.fctrCs
## Q115899.fctrMe
## Q116197.fctrA.M. *
## Q116197.fctrP.M. .
## Q116441.fctrNo
## Q116441.fctrYes
## Q116448.fctrNo
## Q116448.fctrYes
## Q116601.fctrNo
## Q116601.fctrYes
## Q116797.fctrNo
## Q116797.fctrYes
## Q116881.fctrHappy
## Q116881.fctrRight
## Q116953.fctrNo
## Q116953.fctrYes
## `Q117186.fctrCool headed`
## `Q117186.fctrHot headed`
## `Q117193.fctrOdd hours`
## `Q117193.fctrStandard hours`
## Q118117.fctrNo
## Q118117.fctrYes
## Q118232.fctrId **
## Q118232.fctrPr *
## Q118233.fctrNo
## Q118233.fctrYes
## Q118237.fctrNo
## Q118237.fctrYes
## Q118892.fctrNo
## Q118892.fctrYes
## Q119334.fctrNo
## Q119334.fctrYes
## Q119650.fctrGiving
## Q119650.fctrReceiving
## Q119851.fctrNo
## Q119851.fctrYes
## Q120012.fctrNo
## Q120012.fctrYes
## Q120014.fctrNo
## Q120014.fctrYes
## `Q120194.fctrStudy first`
## `Q120194.fctrTry first`
## Q120379.fctrNo
## Q120379.fctrYes
## Q120472.fctrArt
## Q120472.fctrScience .
## Q120650.fctrNo
## Q120650.fctrYes
## Q120978.fctrNo
## Q120978.fctrYes
## Q121011.fctrNo
## Q121011.fctrYes
## Q121699.fctrNo **
## Q121699.fctrYes **
## Q121700.fctrNo .
## Q121700.fctrYes
## Q122120.fctrNo
## Q122120.fctrYes .
## Q122769.fctrNo
## Q122769.fctrYes
## Q122770.fctrNo
## Q122770.fctrYes
## Q122771.fctrPc
## Q122771.fctrPt *
## Q123464.fctrNo
## Q123464.fctrYes
## Q123621.fctrNo
## Q123621.fctrYes
## Q124122.fctrNo
## Q124122.fctrYes
## Q124742.fctrNo
## Q124742.fctrYes
## Q96024.fctrNo
## Q96024.fctrYes
## `Q98059.fctrOnly-child`
## Q98059.fctrYes
## Q98078.fctrNo
## Q98078.fctrYes
## Q98197.fctrNo
## Q98197.fctrYes
## Q98578.fctrNo *
## Q98578.fctrYes *
## Q98869.fctrNo **
## Q98869.fctrYes
## Q99480.fctrNo
## Q99480.fctrYes
## Q99581.fctrNo .
## Q99581.fctrYes
## Q99716.fctrNo *
## Q99716.fctrYes .
## `Q99982.fctrCheck!`
## Q99982.fctrNope
## YOB.Age.fctr.L *
## YOB.Age.fctr.Q
## YOB.Age.fctr.C
## `YOB.Age.fctr^4`
## `YOB.Age.fctr^5` .
## `YOB.Age.fctr^6` .
## `YOB.Age.fctr^7`
## `YOB.Age.fctr^8`
## `Q109244.fctrNA:.clusterid.fctr2`
## `Q109244.fctrNo:.clusterid.fctr2`
## `Q109244.fctrYes:.clusterid.fctr2`
## `Q109244.fctrNA:.clusterid.fctr3`
## `Q109244.fctrNo:.clusterid.fctr3`
## `Q109244.fctrYes:.clusterid.fctr3` **
## `YOB.Age.fctrNA:YOB.Age.dff`
## `YOB.Age.fctr(15,20]:YOB.Age.dff` .
## `YOB.Age.fctr(20,25]:YOB.Age.dff`
## `YOB.Age.fctr(25,30]:YOB.Age.dff`
## `YOB.Age.fctr(30,35]:YOB.Age.dff`
## `YOB.Age.fctr(35,40]:YOB.Age.dff` *
## `YOB.Age.fctr(40,50]:YOB.Age.dff`
## `YOB.Age.fctr(50,65]:YOB.Age.dff`
## `YOB.Age.fctr(65,90]:YOB.Age.dff`
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 6157.1 on 4452 degrees of freedom
## Residual deviance: 5077.7 on 4206 degrees of freedom
## AIC: 5571.7
##
## Number of Fisher Scoring iterations: 5
##
## [1] "myfit_mdl: train diagnostics complete: 20.309000 secs"
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## Prediction
## Reference R D
## R 1031 1062
## D 360 2000
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 6.806647e-01 3.466286e-01 6.667439e-01 6.943483e-01 5.299798e-01
## AccuracyPValue McnemarPValue
## 5.677361e-93 3.906445e-77
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## Warning in predict.lm(object, newdata, se.fit, scale = 1, type =
## ifelse(type == : prediction from a rank-deficient fit may be misleading
## Prediction
## Reference R D
## R 10 514
## D 4 587
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 5.354260e-01 1.303490e-02 5.056423e-01 5.650223e-01 5.300448e-01
## AccuracyPValue McnemarPValue
## 3.709031e-01 8.789157e-111
## [1] "myfit_mdl: predict complete: 34.717000 secs"
## id
## 1 All.X##rcv#glm
## feats
## 1 Q109244.fctr,Hhold.fctr,Edn.fctr,Q101163.fctr,Q100689.fctr,Q98078.fctr,Q99716.fctr,Q120379.fctr,Q121699.fctr,Q105840.fctr,Q113583.fctr,Q115195.fctr,Q102089.fctr,Q98059.fctr,Q114386.fctr,Q100680.fctr,Q108342.fctr,Q111848.fctr,YOB.Age.fctr,Q118892.fctr,Q102687.fctr,Q115390.fctr,Q119851.fctr,Q114517.fctr,Q120012.fctr,Q109367.fctr,Q114961.fctr,Q121700.fctr,Q124122.fctr,Q111220.fctr,Q113992.fctr,Q121011.fctr,Q106042.fctr,Q116448.fctr,Q116601.fctr,Q104996.fctr,Q102906.fctr,Q113584.fctr,Q108950.fctr,Q102674.fctr,Q103293.fctr,Q112478.fctr,Q114748.fctr,Q107491.fctr,Q100562.fctr,Q108617.fctr,Q100010.fctr,Q115602.fctr,Q116953.fctr,Q115610.fctr,Q106997.fctr,Q120978.fctr,Q112512.fctr,Q108343.fctr,Q96024.fctr,Q106389.fctr,.rnorm,Q108754.fctr,Q98578.fctr,Q101162.fctr,Q115777.fctr,Q99581.fctr,Q124742.fctr,Q116797.fctr,Q112270.fctr,Q118237.fctr,Q119650.fctr,Q111580.fctr,Q123464.fctr,Q117193.fctr,Q99982.fctr,Q108856.fctr,Q118233.fctr,Q102289.fctr,Q116197.fctr,Income.fctr,Q118232.fctr,Q120194.fctr,Q114152.fctr,Q122770.fctr,Q117186.fctr,Q105655.fctr,Q106993.fctr,Q119334.fctr,Q122120.fctr,Q116441.fctr,Q118117.fctr,Q123621.fctr,Q122769.fctr,Q120650.fctr,Q98869.fctr,Q107869.fctr,Q120014.fctr,Q115899.fctr,Q106388.fctr,Q99480.fctr,Q122771.fctr,Q108855.fctr,Q110740.fctr,Q106272.fctr,Q101596.fctr,Q116881.fctr,Q120472.fctr,Q98197.fctr,Q113181.fctr,Q115611.fctr,Gender.fctr,Q109244.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
## max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1 1 16.949 2.127
## max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1 0.6942794 0.6741519 0.7144068 0.2311654
## opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1 0.4 0.7377352 0.6305879
## max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1 0.6667439 0.6943483 0.2591768
## max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB max.AUCROCR.OOB
## 1 0.5360836 0.5171756 0.5549915 0.4500685
## opt.prob.threshold.OOB max.f.score.OOB max.Accuracy.OOB
## 1 0.1 0.6938534 0.535426
## max.AccuracyLower.OOB max.AccuracyUpper.OOB max.Kappa.OOB
## 1 0.5056423 0.5650223 0.0130349
## max.AccuracySD.fit max.KappaSD.fit
## 1 0.006875669 0.01415213
## [1] "myfit_mdl: exit: 34.734000 secs"
# Check if other preProcess methods improve model performance
fit.models_1_chunk_df <-
myadd_chunk(fit.models_1_chunk_df, "fit.models_1_preProc", major.inc = FALSE,
label.minor = "preProc")
## label step_major step_minor label_minor bgn end
## 4 fit.models_1_All.X 1 3 glm 665.490 700.278
## 5 fit.models_1_preProc 1 4 preProc 700.279 NA
## elapsed
## 4 34.788
## 5 NA
require(gdata)
mdl_id <- orderBy(get_model_sel_frmla(), glb_models_df)[1, "id"]
indepVar <- trim(unlist(strsplit(glb_models_df[glb_models_df$id == mdl_id,
"feats"], "[,]")))
method <- tail(unlist(strsplit(mdl_id, "[.]")), 1)
mdl_id_pfx <- paste0(head(unlist(strsplit(mdl_id, "[.]")), -1), collapse = ".")
if (!is.null(glbObsFitOutliers[[mdl_id_pfx]])) {
fitobs_df <- glbObsFit[!(glbObsFit[, glbFeatsId] %in%
glbObsFitOutliers[[mdl_id_pfx]]), ]
print(sprintf("Outliers removed: %d", nrow(glbObsFit) - nrow(fitobs_df)))
print(setdiff(glbObsFit[, glbFeatsId], fitobs_df[, glbFeatsId]))
} else fitobs_df <- glbObsFit
for (prePr in glb_preproc_methods) {
# The operations are applied in this order:
# Box-Cox/Yeo-Johnson transformation, centering, scaling, range, imputation, PCA, ICA then spatial sign.
ret_lst <- myfit_mdl(mdl_specs_lst=myinit_mdl_specs_lst(mdl_specs_lst=list(
id.prefix=mdl_id_pfx,
type=glb_model_type, tune.df=glbMdlTuneParams,
trainControl.method="repeatedcv",
trainControl.number=glb_rcv_n_folds,
trainControl.repeats=glb_rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize,
train.method=method, train.preProcess=prePr)),
indepVar=indepVar, rsp_var=glb_rsp_var,
fit_df=fitobs_df, OOB_df=glbObsOOB)
}
# If (All|RFE).X.glm is less accurate than Low.Cor.X.glm
# check NA coefficients & filter appropriate terms in indepVar
# if (method == "glm") {
# orig_glm <- glb_models_lst[[paste0(mdl_id, ".", model_method)]]$finalModel
# orig_glm <- glb_models_lst[["All.X.glm"]]$finalModel; print(summary(orig_glm))
# orig_glm <- glb_models_lst[["RFE.X.glm"]]$finalModel; print(summary(orig_glm))
# require(car)
# vif_orig_glm <- vif(orig_glm); print(vif_orig_glm)
# # if vif errors out with "there are aliased coefficients in the model"
# alias_orig_glm <- alias(orig_glm); alias_complete_orig_glm <- (alias_orig_glm$Complete > 0); alias_complete_orig_glm <- alias_complete_orig_glm[rowSums(alias_complete_orig_glm) > 0, colSums(alias_complete_orig_glm) > 0]; print(alias_complete_orig_glm)
# print(vif_orig_glm[!is.na(vif_orig_glm) & (vif_orig_glm == Inf)])
# print(which.max(vif_orig_glm))
# print(sort(vif_orig_glm[vif_orig_glm >= 1.0e+03], decreasing=TRUE))
# glbObsFit[c(1143, 3637, 3953, 4105), c("UniqueID", "Popular", "H.P.quandary", "Headline")]
# glb_feats_df[glb_feats_df$id %in% grep("[HSA]\\.chrs.n.log", glb_feats_df$id, value=TRUE) | glb_feats_df$cor.high.X %in% grep("[HSA]\\.chrs.n.log", glb_feats_df$id, value=TRUE), ]
# all.equal(glbObsAll$S.chrs.uppr.n.log, glbObsAll$A.chrs.uppr.n.log)
# cor(glbObsAll$S.T.herald, glbObsAll$S.T.tribun)
# mydspObs(Abstract.contains="[Dd]iar", cols=("Abstract"), all=TRUE)
# subset(glb_feats_df, cor.y.abs <= glb_feats_df[glb_feats_df$id == ".rnorm", "cor.y.abs"])
# corxx_mtrx <- cor(data.matrix(glbObsAll[, setdiff(names(glbObsAll), myfind_chr_cols_df(glbObsAll))]), use="pairwise.complete.obs"); abs_corxx_mtrx <- abs(corxx_mtrx); diag(abs_corxx_mtrx) <- 0
# which.max(abs_corxx_mtrx["S.T.tribun", ])
# abs_corxx_mtrx["A.npnct08.log", "S.npnct08.log"]
# step_glm <- step(orig_glm)
# }
# Since caret does not optimize rpart well
# if (method == "rpart")
# ret_lst <- myfit_mdl(mdl_id=paste0(mdl_id_pfx, ".cp.0"), model_method=method,
# indepVar=indepVar,
# model_type=glb_model_type,
# rsp_var=glb_rsp_var,
# fit_df=glbObsFit, OOB_df=glbObsOOB,
# n_cv_folds=0, tune_models_df=data.frame(parameter="cp", min=0.0, max=0.0, by=0.1))
# User specified
# Ensure at least 2 vars in each regression; else varImp crashes
# sav_models_lst <- glb_models_lst; sav_models_df <- glb_models_df; sav_featsimp_df <- glb_featsimp_df; all.equal(sav_featsimp_df, glb_featsimp_df)
# glb_models_lst <- sav_models_lst; glb_models_df <- sav_models_df; glm_featsimp_df <- sav_featsimp_df
# easier to exclude features
# require(gdata) # needed for trim
# mdl_id <- "";
# indepVar <- head(subset(glb_models_df, grepl("All\\.X\\.", mdl_id), select=feats)
# , 1)[, "feats"]
# indepVar <- trim(unlist(strsplit(indepVar, "[,]")))
# indepVar <- setdiff(indepVar, ".rnorm")
# easier to include features
#stop(here"); sav_models_df <- glb_models_df; glb_models_df <- sav_models_df
# !_sp
# mdl_id <- "csm"; indepVar <- c(NULL
# ,"prdline.my.fctr", "prdline.my.fctr:.clusterid.fctr"
# ,"prdline.my.fctr*biddable"
# #,"prdline.my.fctr*startprice.log"
# #,"prdline.my.fctr*startprice.diff"
# ,"prdline.my.fctr*condition.fctr"
# ,"prdline.my.fctr*D.terms.post.stop.n"
# #,"prdline.my.fctr*D.terms.post.stem.n"
# ,"prdline.my.fctr*cellular.fctr"
# # ,"<feat1>:<feat2>"
# )
# for (method in glbMdlMethods) {
# ret_lst <- myfit_mdl(mdl_id=mdl_id, model_method=method,
# indepVar=indepVar,
# model_type=glb_model_type,
# rsp_var=glb_rsp_var,
# fit_df=glbObsFit, OOB_df=glbObsOOB,
# n_cv_folds=glb_rcv_n_folds, tune_models_df=glbMdlTuneParams)
# csm_mdl_id <- paste0(mdl_id, ".", method)
# csm_featsimp_df <- myget_feats_importance(glb_models_lst[[paste0(mdl_id, ".",
# method)]]); print(head(csm_featsimp_df))
# }
###
# Ntv.1.lm <- lm(reformulate(indepVar, glb_rsp_var), glbObsTrn); print(summary(Ntv.1.lm))
#glb_models_df[, "max.Accuracy.OOB", FALSE]
#varImp(glb_models_lst[["Low.cor.X.glm"]])
#orderBy(~ -Overall, varImp(glb_models_lst[["All.X.2.glm"]])$imp)
#orderBy(~ -Overall, varImp(glb_models_lst[["All.X.3.glm"]])$imp)
#glb_feats_df[grepl("npnct28", glb_feats_df$id), ]
# User specified bivariate models
# indepVar_lst <- list()
# for (feat in setdiff(names(glbObsFit),
# union(glb_rsp_var, glbFeatsExclude)))
# indepVar_lst[["feat"]] <- feat
# User specified combinatorial models
# indepVar_lst <- list()
# combn_mtrx <- combn(c("<feat1_name>", "<feat2_name>", "<featn_name>"),
# <num_feats_to_choose>)
# for (combn_ix in 1:ncol(combn_mtrx))
# #print(combn_mtrx[, combn_ix])
# indepVar_lst[[combn_ix]] <- combn_mtrx[, combn_ix]
# template for myfit_mdl
# rf is hard-coded in caret to recognize only Accuracy / Kappa evaluation metrics
# only for OOB in trainControl ?
# ret_lst <- myfit_mdl_fn(mdl_id=paste0(mdl_id_pfx, ""), model_method=method,
# indepVar=indepVar,
# rsp_var=glb_rsp_var,
# fit_df=glbObsFit, OOB_df=glbObsOOB,
# n_cv_folds=glb_rcv_n_folds, tune_models_df=glbMdlTuneParams,
# model_loss_mtrx=glbMdlMetric_terms,
# model_summaryFunction=glbMdlMetricSummaryFn,
# model_metric=glbMdlMetricSummary,
# model_metric_maximize=glbMdlMetricMaximize)
# Simplify a model
# fit_df <- glbObsFit; glb_mdl <- step(<complex>_mdl)
# Non-caret models
# rpart_area_mdl <- rpart(reformulate("Area", response=glb_rsp_var),
# data=glbObsFit, #method="class",
# control=rpart.control(cp=0.12),
# parms=list(loss=glbMdlMetric_terms))
# print("rpart_sel_wlm_mdl"); prp(rpart_sel_wlm_mdl)
#
print(glb_models_df)
## id
## MFO###myMFO_classfr MFO###myMFO_classfr
## Random###myrandom_classfr Random###myrandom_classfr
## Max.cor.Y.rcv.1X1###glmnet Max.cor.Y.rcv.1X1###glmnet
## Max.cor.Y##rcv#rpart Max.cor.Y##rcv#rpart
## Interact.High.cor.Y##rcv#glmnet Interact.High.cor.Y##rcv#glmnet
## Low.cor.X##rcv#glmnet Low.cor.X##rcv#glmnet
## All.X##rcv#glmnet All.X##rcv#glmnet
## All.X##rcv#glm All.X##rcv#glm
## feats
## MFO###myMFO_classfr .rnorm
## Random###myrandom_classfr .rnorm
## Max.cor.Y.rcv.1X1###glmnet Q109244.fctr,Gender.fctr
## Max.cor.Y##rcv#rpart Q109244.fctr,Gender.fctr
## Interact.High.cor.Y##rcv#glmnet Q109244.fctr,Gender.fctr,Q109244.fctr:Q99480.fctr,Q109244.fctr:Q98078.fctr,Q109244.fctr:Q100689.fctr,Q109244.fctr:Q108855.fctr,Q109244.fctr:Q123621.fctr,Q109244.fctr:Q122771.fctr,Q109244.fctr:Q120472.fctr,Q109244.fctr:Q106272.fctr
## Low.cor.X##rcv#glmnet Q109244.fctr,Hhold.fctr,Edn.fctr,Q101163.fctr,Q100689.fctr,Q98078.fctr,Q99716.fctr,Q120379.fctr,Q121699.fctr,Q105840.fctr,Q113583.fctr,Q115195.fctr,Q102089.fctr,Q98059.fctr,Q114386.fctr,Q100680.fctr,Q108342.fctr,Q111848.fctr,YOB.Age.fctr,Q118892.fctr,Q102687.fctr,Q115390.fctr,Q119851.fctr,Q114517.fctr,Q120012.fctr,Q109367.fctr,Q114961.fctr,Q121700.fctr,Q124122.fctr,Q111220.fctr,Q113992.fctr,Q121011.fctr,Q106042.fctr,Q116448.fctr,Q116601.fctr,Q104996.fctr,Q102906.fctr,Q113584.fctr,Q108950.fctr,Q102674.fctr,Q103293.fctr,Q112478.fctr,Q114748.fctr,Q107491.fctr,Q100562.fctr,Q108617.fctr,Q100010.fctr,Q115602.fctr,Q116953.fctr,Q115610.fctr,Q106997.fctr,Q120978.fctr,Q112512.fctr,Q108343.fctr,Q96024.fctr,Q106389.fctr,.rnorm,Q108754.fctr,Q98578.fctr,Q101162.fctr,Q115777.fctr,Q99581.fctr,Q124742.fctr,Q116797.fctr,Q112270.fctr,Q118237.fctr,Q119650.fctr,Q111580.fctr,Q123464.fctr,Q117193.fctr,Q99982.fctr,Q108856.fctr,Q118233.fctr,Q102289.fctr,Q116197.fctr,Income.fctr,Q118232.fctr,Q120194.fctr,Q114152.fctr,Q122770.fctr,Q117186.fctr,Q105655.fctr,Q106993.fctr,Q119334.fctr,Q122120.fctr,Q116441.fctr,Q118117.fctr,Q123621.fctr,Q122769.fctr,Q120650.fctr,Q98869.fctr,Q107869.fctr,Q120014.fctr,Q115899.fctr,Q106388.fctr,Q99480.fctr,Q122771.fctr,Q108855.fctr,Q110740.fctr,Q106272.fctr,Q101596.fctr,Q116881.fctr,Q120472.fctr,Q98197.fctr,Q113181.fctr,Q115611.fctr,Gender.fctr,Q109244.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
## All.X##rcv#glmnet Q109244.fctr,Hhold.fctr,Edn.fctr,Q101163.fctr,Q100689.fctr,Q98078.fctr,Q99716.fctr,Q120379.fctr,Q121699.fctr,Q105840.fctr,Q113583.fctr,Q115195.fctr,Q102089.fctr,Q98059.fctr,Q114386.fctr,Q100680.fctr,Q108342.fctr,Q111848.fctr,YOB.Age.fctr,Q118892.fctr,Q102687.fctr,Q115390.fctr,Q119851.fctr,Q114517.fctr,Q120012.fctr,Q109367.fctr,Q114961.fctr,Q121700.fctr,Q124122.fctr,Q111220.fctr,Q113992.fctr,Q121011.fctr,Q106042.fctr,Q116448.fctr,Q116601.fctr,Q104996.fctr,Q102906.fctr,Q113584.fctr,Q108950.fctr,Q102674.fctr,Q103293.fctr,Q112478.fctr,Q114748.fctr,Q107491.fctr,Q100562.fctr,Q108617.fctr,Q100010.fctr,Q115602.fctr,Q116953.fctr,Q115610.fctr,Q106997.fctr,Q120978.fctr,Q112512.fctr,Q108343.fctr,Q96024.fctr,Q106389.fctr,.rnorm,Q108754.fctr,Q98578.fctr,Q101162.fctr,Q115777.fctr,Q99581.fctr,Q124742.fctr,Q116797.fctr,Q112270.fctr,Q118237.fctr,Q119650.fctr,Q111580.fctr,Q123464.fctr,Q117193.fctr,Q99982.fctr,Q108856.fctr,Q118233.fctr,Q102289.fctr,Q116197.fctr,Income.fctr,Q118232.fctr,Q120194.fctr,Q114152.fctr,Q122770.fctr,Q117186.fctr,Q105655.fctr,Q106993.fctr,Q119334.fctr,Q122120.fctr,Q116441.fctr,Q118117.fctr,Q123621.fctr,Q122769.fctr,Q120650.fctr,Q98869.fctr,Q107869.fctr,Q120014.fctr,Q115899.fctr,Q106388.fctr,Q99480.fctr,Q122771.fctr,Q108855.fctr,Q110740.fctr,Q106272.fctr,Q101596.fctr,Q116881.fctr,Q120472.fctr,Q98197.fctr,Q113181.fctr,Q115611.fctr,Gender.fctr,Q109244.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
## All.X##rcv#glm Q109244.fctr,Hhold.fctr,Edn.fctr,Q101163.fctr,Q100689.fctr,Q98078.fctr,Q99716.fctr,Q120379.fctr,Q121699.fctr,Q105840.fctr,Q113583.fctr,Q115195.fctr,Q102089.fctr,Q98059.fctr,Q114386.fctr,Q100680.fctr,Q108342.fctr,Q111848.fctr,YOB.Age.fctr,Q118892.fctr,Q102687.fctr,Q115390.fctr,Q119851.fctr,Q114517.fctr,Q120012.fctr,Q109367.fctr,Q114961.fctr,Q121700.fctr,Q124122.fctr,Q111220.fctr,Q113992.fctr,Q121011.fctr,Q106042.fctr,Q116448.fctr,Q116601.fctr,Q104996.fctr,Q102906.fctr,Q113584.fctr,Q108950.fctr,Q102674.fctr,Q103293.fctr,Q112478.fctr,Q114748.fctr,Q107491.fctr,Q100562.fctr,Q108617.fctr,Q100010.fctr,Q115602.fctr,Q116953.fctr,Q115610.fctr,Q106997.fctr,Q120978.fctr,Q112512.fctr,Q108343.fctr,Q96024.fctr,Q106389.fctr,.rnorm,Q108754.fctr,Q98578.fctr,Q101162.fctr,Q115777.fctr,Q99581.fctr,Q124742.fctr,Q116797.fctr,Q112270.fctr,Q118237.fctr,Q119650.fctr,Q111580.fctr,Q123464.fctr,Q117193.fctr,Q99982.fctr,Q108856.fctr,Q118233.fctr,Q102289.fctr,Q116197.fctr,Income.fctr,Q118232.fctr,Q120194.fctr,Q114152.fctr,Q122770.fctr,Q117186.fctr,Q105655.fctr,Q106993.fctr,Q119334.fctr,Q122120.fctr,Q116441.fctr,Q118117.fctr,Q123621.fctr,Q122769.fctr,Q120650.fctr,Q98869.fctr,Q107869.fctr,Q120014.fctr,Q115899.fctr,Q106388.fctr,Q99480.fctr,Q122771.fctr,Q108855.fctr,Q110740.fctr,Q106272.fctr,Q101596.fctr,Q116881.fctr,Q120472.fctr,Q98197.fctr,Q113181.fctr,Q115611.fctr,Gender.fctr,Q109244.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
## max.nTuningRuns min.elapsedtime.everything
## MFO###myMFO_classfr 0 1.335
## Random###myrandom_classfr 0 0.322
## Max.cor.Y.rcv.1X1###glmnet 0 1.013
## Max.cor.Y##rcv#rpart 5 1.684
## Interact.High.cor.Y##rcv#glmnet 25 5.288
## Low.cor.X##rcv#glmnet 25 25.391
## All.X##rcv#glmnet 25 25.483
## All.X##rcv#glm 1 16.949
## min.elapsedtime.final max.AUCpROC.fit
## MFO###myMFO_classfr 0.004 0.5000000
## Random###myrandom_classfr 0.003 0.4943556
## Max.cor.Y.rcv.1X1###glmnet 0.068 0.6195812
## Max.cor.Y##rcv#rpart 0.028 0.6195812
## Interact.High.cor.Y##rcv#glmnet 0.346 0.6372713
## Low.cor.X##rcv#glmnet 2.535 0.6756101
## All.X##rcv#glmnet 2.849 0.6756101
## All.X##rcv#glm 2.127 0.6942794
## max.Sens.fit max.Spec.fit max.AUCROCR.fit
## MFO###myMFO_classfr 0.0000000 1.0000000 0.5000000
## Random###myrandom_classfr 0.4620162 0.5266949 0.4989014
## Max.cor.Y.rcv.1X1###glmnet 0.5671285 0.6720339 0.3267482
## Max.cor.Y##rcv#rpart 0.5671285 0.6720339 0.3369762
## Interact.High.cor.Y##rcv#glmnet 0.6364071 0.6381356 0.3046595
## Low.cor.X##rcv#glmnet 0.6287625 0.7224576 0.2521176
## All.X##rcv#glmnet 0.6287625 0.7224576 0.2521176
## All.X##rcv#glm 0.6741519 0.7144068 0.2311654
## opt.prob.threshold.fit max.f.score.fit
## MFO###myMFO_classfr 0.00 0.6927932
## Random###myrandom_classfr 0.00 0.6927932
## Max.cor.Y.rcv.1X1###glmnet 0.00 0.6927932
## Max.cor.Y##rcv#rpart 0.00 0.6927932
## Interact.High.cor.Y##rcv#glmnet 0.35 0.6969744
## Low.cor.X##rcv#glmnet 0.45 0.7249263
## All.X##rcv#glmnet 0.45 0.7249263
## All.X##rcv#glm 0.40 0.7377352
## max.Accuracy.fit max.AccuracyLower.fit
## MFO###myMFO_classfr 0.5299798 0.5151927
## Random###myrandom_classfr 0.5299798 0.5151927
## Max.cor.Y.rcv.1X1###glmnet 0.5299798 0.5151927
## Max.cor.Y##rcv#rpart 0.6227314 0.5151927
## Interact.High.cor.Y##rcv#glmnet 0.6276719 0.5512016
## Low.cor.X##rcv#glmnet 0.6543941 0.6508645
## All.X##rcv#glmnet 0.6543941 0.6508645
## All.X##rcv#glm 0.6305879 0.6667439
## max.AccuracyUpper.fit max.Kappa.fit
## MFO###myMFO_classfr 0.5447275 0.0000000
## Random###myrandom_classfr 0.5447275 0.0000000
## Max.cor.Y.rcv.1X1###glmnet 0.5447275 0.0000000
## Max.cor.Y##rcv#rpart 0.5447275 0.2400193
## Interact.High.cor.Y##rcv#glmnet 0.5805331 0.2550614
## Low.cor.X##rcv#glmnet 0.6788088 0.3044902
## All.X##rcv#glmnet 0.6788088 0.3044902
## All.X##rcv#glm 0.6943483 0.2591768
## max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB
## MFO###myMFO_classfr 0.5000000 0.0000000 1.0000000
## Random###myrandom_classfr 0.5268661 0.5038168 0.5499154
## Max.cor.Y.rcv.1X1###glmnet 0.4999322 0.4465649 0.5532995
## Max.cor.Y##rcv#rpart 0.4999322 0.4465649 0.5532995
## Interact.High.cor.Y##rcv#glmnet 0.5157790 0.5171756 0.5143824
## Low.cor.X##rcv#glmnet 0.5457838 0.4942748 0.5972927
## All.X##rcv#glmnet 0.5457838 0.4942748 0.5972927
## All.X##rcv#glm 0.5360836 0.5171756 0.5549915
## max.AUCROCR.OOB opt.prob.threshold.OOB
## MFO###myMFO_classfr 0.5000000 0.0
## Random###myrandom_classfr 0.5178149 0.0
## Max.cor.Y.rcv.1X1###glmnet 0.4910312 0.0
## Max.cor.Y##rcv#rpart 0.4999354 0.0
## Interact.High.cor.Y##rcv#glmnet 0.4731743 0.0
## Low.cor.X##rcv#glmnet 0.4412078 0.2
## All.X##rcv#glmnet 0.4412078 0.2
## All.X##rcv#glm 0.4500685 0.1
## max.f.score.OOB max.Accuracy.OOB
## MFO###myMFO_classfr 0.6928488 0.5300448
## Random###myrandom_classfr 0.6928488 0.5300448
## Max.cor.Y.rcv.1X1###glmnet 0.6928488 0.5300448
## Max.cor.Y##rcv#rpart 0.6928488 0.5300448
## Interact.High.cor.Y##rcv#glmnet 0.6928488 0.5300448
## Low.cor.X##rcv#glmnet 0.6941662 0.5345291
## All.X##rcv#glmnet 0.6941662 0.5345291
## All.X##rcv#glm 0.6938534 0.5354260
## max.AccuracyLower.OOB
## MFO###myMFO_classfr 0.5002547
## Random###myrandom_classfr 0.5002547
## Max.cor.Y.rcv.1X1###glmnet 0.5002547
## Max.cor.Y##rcv#rpart 0.5002547
## Interact.High.cor.Y##rcv#glmnet 0.5002547
## Low.cor.X##rcv#glmnet 0.5047442
## All.X##rcv#glmnet 0.5047442
## All.X##rcv#glm 0.5056423
## max.AccuracyUpper.OOB max.Kappa.OOB
## MFO###myMFO_classfr 0.5596760 0.00000000
## Random###myrandom_classfr 0.5596760 0.00000000
## Max.cor.Y.rcv.1X1###glmnet 0.5596760 0.00000000
## Max.cor.Y##rcv#rpart 0.5596760 0.00000000
## Interact.High.cor.Y##rcv#glmnet 0.5596760 0.00000000
## Low.cor.X##rcv#glmnet 0.5641315 0.01056316
## All.X##rcv#glmnet 0.5641315 0.01056316
## All.X##rcv#glm 0.5650223 0.01303490
## max.AccuracySD.fit max.KappaSD.fit
## MFO###myMFO_classfr NA NA
## Random###myrandom_classfr NA NA
## Max.cor.Y.rcv.1X1###glmnet NA NA
## Max.cor.Y##rcv#rpart 0.014202428 0.02887036
## Interact.High.cor.Y##rcv#glmnet 0.012724205 0.02650871
## Low.cor.X##rcv#glmnet 0.009303742 0.01932802
## All.X##rcv#glmnet 0.009303742 0.01932802
## All.X##rcv#glm 0.006875669 0.01415213
rm(ret_lst)
fit.models_1_chunk_df <-
myadd_chunk(fit.models_1_chunk_df, "fit.models_1_end", major.inc = FALSE,
label.minor = "teardown")
## label step_major step_minor label_minor bgn end
## 5 fit.models_1_preProc 1 4 preProc 700.279 700.367
## 6 fit.models_1_end 1 5 teardown 700.367 NA
## elapsed
## 5 0.088
## 6 NA
glb_chunks_df <- myadd_chunk(glb_chunks_df, "fit.models", major.inc = FALSE)
## label step_major step_minor label_minor bgn end elapsed
## 17 fit.models 8 1 1 622.314 700.377 78.063
## 18 fit.models 8 2 2 700.378 NA NA
fit.models_2_chunk_df <-
myadd_chunk(NULL, "fit.models_2_bgn", label.minor = "setup")
## label step_major step_minor label_minor bgn end elapsed
## 1 fit.models_2_bgn 1 0 setup 706.783 NA NA
plt_models_df <- glb_models_df[, -grep("SD|Upper|Lower", names(glb_models_df))]
for (var in grep("^min.", names(plt_models_df), value=TRUE)) {
plt_models_df[, sub("min.", "inv.", var)] <-
#ifelse(all(is.na(tmp <- plt_models_df[, var])), NA, 1.0 / tmp)
1.0 / plt_models_df[, var]
plt_models_df <- plt_models_df[ , -grep(var, names(plt_models_df))]
}
print(plt_models_df)
## id
## MFO###myMFO_classfr MFO###myMFO_classfr
## Random###myrandom_classfr Random###myrandom_classfr
## Max.cor.Y.rcv.1X1###glmnet Max.cor.Y.rcv.1X1###glmnet
## Max.cor.Y##rcv#rpart Max.cor.Y##rcv#rpart
## Interact.High.cor.Y##rcv#glmnet Interact.High.cor.Y##rcv#glmnet
## Low.cor.X##rcv#glmnet Low.cor.X##rcv#glmnet
## All.X##rcv#glmnet All.X##rcv#glmnet
## All.X##rcv#glm All.X##rcv#glm
## feats
## MFO###myMFO_classfr .rnorm
## Random###myrandom_classfr .rnorm
## Max.cor.Y.rcv.1X1###glmnet Q109244.fctr,Gender.fctr
## Max.cor.Y##rcv#rpart Q109244.fctr,Gender.fctr
## Interact.High.cor.Y##rcv#glmnet Q109244.fctr,Gender.fctr,Q109244.fctr:Q99480.fctr,Q109244.fctr:Q98078.fctr,Q109244.fctr:Q100689.fctr,Q109244.fctr:Q108855.fctr,Q109244.fctr:Q123621.fctr,Q109244.fctr:Q122771.fctr,Q109244.fctr:Q120472.fctr,Q109244.fctr:Q106272.fctr
## Low.cor.X##rcv#glmnet Q109244.fctr,Hhold.fctr,Edn.fctr,Q101163.fctr,Q100689.fctr,Q98078.fctr,Q99716.fctr,Q120379.fctr,Q121699.fctr,Q105840.fctr,Q113583.fctr,Q115195.fctr,Q102089.fctr,Q98059.fctr,Q114386.fctr,Q100680.fctr,Q108342.fctr,Q111848.fctr,YOB.Age.fctr,Q118892.fctr,Q102687.fctr,Q115390.fctr,Q119851.fctr,Q114517.fctr,Q120012.fctr,Q109367.fctr,Q114961.fctr,Q121700.fctr,Q124122.fctr,Q111220.fctr,Q113992.fctr,Q121011.fctr,Q106042.fctr,Q116448.fctr,Q116601.fctr,Q104996.fctr,Q102906.fctr,Q113584.fctr,Q108950.fctr,Q102674.fctr,Q103293.fctr,Q112478.fctr,Q114748.fctr,Q107491.fctr,Q100562.fctr,Q108617.fctr,Q100010.fctr,Q115602.fctr,Q116953.fctr,Q115610.fctr,Q106997.fctr,Q120978.fctr,Q112512.fctr,Q108343.fctr,Q96024.fctr,Q106389.fctr,.rnorm,Q108754.fctr,Q98578.fctr,Q101162.fctr,Q115777.fctr,Q99581.fctr,Q124742.fctr,Q116797.fctr,Q112270.fctr,Q118237.fctr,Q119650.fctr,Q111580.fctr,Q123464.fctr,Q117193.fctr,Q99982.fctr,Q108856.fctr,Q118233.fctr,Q102289.fctr,Q116197.fctr,Income.fctr,Q118232.fctr,Q120194.fctr,Q114152.fctr,Q122770.fctr,Q117186.fctr,Q105655.fctr,Q106993.fctr,Q119334.fctr,Q122120.fctr,Q116441.fctr,Q118117.fctr,Q123621.fctr,Q122769.fctr,Q120650.fctr,Q98869.fctr,Q107869.fctr,Q120014.fctr,Q115899.fctr,Q106388.fctr,Q99480.fctr,Q122771.fctr,Q108855.fctr,Q110740.fctr,Q106272.fctr,Q101596.fctr,Q116881.fctr,Q120472.fctr,Q98197.fctr,Q113181.fctr,Q115611.fctr,Gender.fctr,Q109244.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
## All.X##rcv#glmnet Q109244.fctr,Hhold.fctr,Edn.fctr,Q101163.fctr,Q100689.fctr,Q98078.fctr,Q99716.fctr,Q120379.fctr,Q121699.fctr,Q105840.fctr,Q113583.fctr,Q115195.fctr,Q102089.fctr,Q98059.fctr,Q114386.fctr,Q100680.fctr,Q108342.fctr,Q111848.fctr,YOB.Age.fctr,Q118892.fctr,Q102687.fctr,Q115390.fctr,Q119851.fctr,Q114517.fctr,Q120012.fctr,Q109367.fctr,Q114961.fctr,Q121700.fctr,Q124122.fctr,Q111220.fctr,Q113992.fctr,Q121011.fctr,Q106042.fctr,Q116448.fctr,Q116601.fctr,Q104996.fctr,Q102906.fctr,Q113584.fctr,Q108950.fctr,Q102674.fctr,Q103293.fctr,Q112478.fctr,Q114748.fctr,Q107491.fctr,Q100562.fctr,Q108617.fctr,Q100010.fctr,Q115602.fctr,Q116953.fctr,Q115610.fctr,Q106997.fctr,Q120978.fctr,Q112512.fctr,Q108343.fctr,Q96024.fctr,Q106389.fctr,.rnorm,Q108754.fctr,Q98578.fctr,Q101162.fctr,Q115777.fctr,Q99581.fctr,Q124742.fctr,Q116797.fctr,Q112270.fctr,Q118237.fctr,Q119650.fctr,Q111580.fctr,Q123464.fctr,Q117193.fctr,Q99982.fctr,Q108856.fctr,Q118233.fctr,Q102289.fctr,Q116197.fctr,Income.fctr,Q118232.fctr,Q120194.fctr,Q114152.fctr,Q122770.fctr,Q117186.fctr,Q105655.fctr,Q106993.fctr,Q119334.fctr,Q122120.fctr,Q116441.fctr,Q118117.fctr,Q123621.fctr,Q122769.fctr,Q120650.fctr,Q98869.fctr,Q107869.fctr,Q120014.fctr,Q115899.fctr,Q106388.fctr,Q99480.fctr,Q122771.fctr,Q108855.fctr,Q110740.fctr,Q106272.fctr,Q101596.fctr,Q116881.fctr,Q120472.fctr,Q98197.fctr,Q113181.fctr,Q115611.fctr,Gender.fctr,Q109244.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
## All.X##rcv#glm Q109244.fctr,Hhold.fctr,Edn.fctr,Q101163.fctr,Q100689.fctr,Q98078.fctr,Q99716.fctr,Q120379.fctr,Q121699.fctr,Q105840.fctr,Q113583.fctr,Q115195.fctr,Q102089.fctr,Q98059.fctr,Q114386.fctr,Q100680.fctr,Q108342.fctr,Q111848.fctr,YOB.Age.fctr,Q118892.fctr,Q102687.fctr,Q115390.fctr,Q119851.fctr,Q114517.fctr,Q120012.fctr,Q109367.fctr,Q114961.fctr,Q121700.fctr,Q124122.fctr,Q111220.fctr,Q113992.fctr,Q121011.fctr,Q106042.fctr,Q116448.fctr,Q116601.fctr,Q104996.fctr,Q102906.fctr,Q113584.fctr,Q108950.fctr,Q102674.fctr,Q103293.fctr,Q112478.fctr,Q114748.fctr,Q107491.fctr,Q100562.fctr,Q108617.fctr,Q100010.fctr,Q115602.fctr,Q116953.fctr,Q115610.fctr,Q106997.fctr,Q120978.fctr,Q112512.fctr,Q108343.fctr,Q96024.fctr,Q106389.fctr,.rnorm,Q108754.fctr,Q98578.fctr,Q101162.fctr,Q115777.fctr,Q99581.fctr,Q124742.fctr,Q116797.fctr,Q112270.fctr,Q118237.fctr,Q119650.fctr,Q111580.fctr,Q123464.fctr,Q117193.fctr,Q99982.fctr,Q108856.fctr,Q118233.fctr,Q102289.fctr,Q116197.fctr,Income.fctr,Q118232.fctr,Q120194.fctr,Q114152.fctr,Q122770.fctr,Q117186.fctr,Q105655.fctr,Q106993.fctr,Q119334.fctr,Q122120.fctr,Q116441.fctr,Q118117.fctr,Q123621.fctr,Q122769.fctr,Q120650.fctr,Q98869.fctr,Q107869.fctr,Q120014.fctr,Q115899.fctr,Q106388.fctr,Q99480.fctr,Q122771.fctr,Q108855.fctr,Q110740.fctr,Q106272.fctr,Q101596.fctr,Q116881.fctr,Q120472.fctr,Q98197.fctr,Q113181.fctr,Q115611.fctr,Gender.fctr,Q109244.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
## max.nTuningRuns max.AUCpROC.fit
## MFO###myMFO_classfr 0 0.5000000
## Random###myrandom_classfr 0 0.4943556
## Max.cor.Y.rcv.1X1###glmnet 0 0.6195812
## Max.cor.Y##rcv#rpart 5 0.6195812
## Interact.High.cor.Y##rcv#glmnet 25 0.6372713
## Low.cor.X##rcv#glmnet 25 0.6756101
## All.X##rcv#glmnet 25 0.6756101
## All.X##rcv#glm 1 0.6942794
## max.Sens.fit max.Spec.fit max.AUCROCR.fit
## MFO###myMFO_classfr 0.0000000 1.0000000 0.5000000
## Random###myrandom_classfr 0.4620162 0.5266949 0.4989014
## Max.cor.Y.rcv.1X1###glmnet 0.5671285 0.6720339 0.3267482
## Max.cor.Y##rcv#rpart 0.5671285 0.6720339 0.3369762
## Interact.High.cor.Y##rcv#glmnet 0.6364071 0.6381356 0.3046595
## Low.cor.X##rcv#glmnet 0.6287625 0.7224576 0.2521176
## All.X##rcv#glmnet 0.6287625 0.7224576 0.2521176
## All.X##rcv#glm 0.6741519 0.7144068 0.2311654
## opt.prob.threshold.fit max.f.score.fit
## MFO###myMFO_classfr 0.00 0.6927932
## Random###myrandom_classfr 0.00 0.6927932
## Max.cor.Y.rcv.1X1###glmnet 0.00 0.6927932
## Max.cor.Y##rcv#rpart 0.00 0.6927932
## Interact.High.cor.Y##rcv#glmnet 0.35 0.6969744
## Low.cor.X##rcv#glmnet 0.45 0.7249263
## All.X##rcv#glmnet 0.45 0.7249263
## All.X##rcv#glm 0.40 0.7377352
## max.Accuracy.fit max.Kappa.fit
## MFO###myMFO_classfr 0.5299798 0.0000000
## Random###myrandom_classfr 0.5299798 0.0000000
## Max.cor.Y.rcv.1X1###glmnet 0.5299798 0.0000000
## Max.cor.Y##rcv#rpart 0.6227314 0.2400193
## Interact.High.cor.Y##rcv#glmnet 0.6276719 0.2550614
## Low.cor.X##rcv#glmnet 0.6543941 0.3044902
## All.X##rcv#glmnet 0.6543941 0.3044902
## All.X##rcv#glm 0.6305879 0.2591768
## max.AUCpROC.OOB max.Sens.OOB max.Spec.OOB
## MFO###myMFO_classfr 0.5000000 0.0000000 1.0000000
## Random###myrandom_classfr 0.5268661 0.5038168 0.5499154
## Max.cor.Y.rcv.1X1###glmnet 0.4999322 0.4465649 0.5532995
## Max.cor.Y##rcv#rpart 0.4999322 0.4465649 0.5532995
## Interact.High.cor.Y##rcv#glmnet 0.5157790 0.5171756 0.5143824
## Low.cor.X##rcv#glmnet 0.5457838 0.4942748 0.5972927
## All.X##rcv#glmnet 0.5457838 0.4942748 0.5972927
## All.X##rcv#glm 0.5360836 0.5171756 0.5549915
## max.AUCROCR.OOB opt.prob.threshold.OOB
## MFO###myMFO_classfr 0.5000000 0.0
## Random###myrandom_classfr 0.5178149 0.0
## Max.cor.Y.rcv.1X1###glmnet 0.4910312 0.0
## Max.cor.Y##rcv#rpart 0.4999354 0.0
## Interact.High.cor.Y##rcv#glmnet 0.4731743 0.0
## Low.cor.X##rcv#glmnet 0.4412078 0.2
## All.X##rcv#glmnet 0.4412078 0.2
## All.X##rcv#glm 0.4500685 0.1
## max.f.score.OOB max.Accuracy.OOB
## MFO###myMFO_classfr 0.6928488 0.5300448
## Random###myrandom_classfr 0.6928488 0.5300448
## Max.cor.Y.rcv.1X1###glmnet 0.6928488 0.5300448
## Max.cor.Y##rcv#rpart 0.6928488 0.5300448
## Interact.High.cor.Y##rcv#glmnet 0.6928488 0.5300448
## Low.cor.X##rcv#glmnet 0.6941662 0.5345291
## All.X##rcv#glmnet 0.6941662 0.5345291
## All.X##rcv#glm 0.6938534 0.5354260
## max.Kappa.OOB inv.elapsedtime.everything
## MFO###myMFO_classfr 0.00000000 0.74906367
## Random###myrandom_classfr 0.00000000 3.10559006
## Max.cor.Y.rcv.1X1###glmnet 0.00000000 0.98716683
## Max.cor.Y##rcv#rpart 0.00000000 0.59382423
## Interact.High.cor.Y##rcv#glmnet 0.00000000 0.18910741
## Low.cor.X##rcv#glmnet 0.01056316 0.03938403
## All.X##rcv#glmnet 0.01056316 0.03924185
## All.X##rcv#glm 0.01303490 0.05900053
## inv.elapsedtime.final
## MFO###myMFO_classfr 250.0000000
## Random###myrandom_classfr 333.3333333
## Max.cor.Y.rcv.1X1###glmnet 14.7058824
## Max.cor.Y##rcv#rpart 35.7142857
## Interact.High.cor.Y##rcv#glmnet 2.8901734
## Low.cor.X##rcv#glmnet 0.3944773
## All.X##rcv#glmnet 0.3510004
## All.X##rcv#glm 0.4701457
# print(myplot_radar(radar_inp_df=plt_models_df))
# print(myplot_radar(radar_inp_df=subset(plt_models_df,
# !(mdl_id %in% grep("random|MFO", plt_models_df$id, value=TRUE)))))
# Compute CI for <metric>SD
glb_models_df <- mutate(glb_models_df,
max.df = ifelse(max.nTuningRuns > 1, max.nTuningRuns - 1, NA),
min.sd2ci.scaler = ifelse(is.na(max.df), NA, qt(0.975, max.df)))
for (var in grep("SD", names(glb_models_df), value=TRUE)) {
# Does CI alredy exist ?
var_components <- unlist(strsplit(var, "SD"))
varActul <- paste0(var_components[1], var_components[2])
varUpper <- paste0(var_components[1], "Upper", var_components[2])
varLower <- paste0(var_components[1], "Lower", var_components[2])
if (varUpper %in% names(glb_models_df)) {
warning(varUpper, " already exists in glb_models_df")
# Assuming Lower also exists
next
}
print(sprintf("var:%s", var))
# CI is dependent on sample size in t distribution; df=n-1
glb_models_df[, varUpper] <- glb_models_df[, varActul] +
glb_models_df[, "min.sd2ci.scaler"] * glb_models_df[, var]
glb_models_df[, varLower] <- glb_models_df[, varActul] -
glb_models_df[, "min.sd2ci.scaler"] * glb_models_df[, var]
}
## Warning: max.AccuracyUpper.fit already exists in glb_models_df
## [1] "var:max.KappaSD.fit"
# Plot metrics with CI
plt_models_df <- glb_models_df[, "id", FALSE]
pltCI_models_df <- glb_models_df[, "id", FALSE]
for (var in grep("Upper", names(glb_models_df), value=TRUE)) {
var_components <- unlist(strsplit(var, "Upper"))
col_name <- unlist(paste(var_components, collapse=""))
plt_models_df[, col_name] <- glb_models_df[, col_name]
for (name in paste0(var_components[1], c("Upper", "Lower"), var_components[2]))
pltCI_models_df[, name] <- glb_models_df[, name]
}
build_statsCI_data <- function(plt_models_df) {
mltd_models_df <- melt(plt_models_df, id.vars="id")
mltd_models_df$data <- sapply(1:nrow(mltd_models_df),
function(row_ix) tail(unlist(strsplit(as.character(
mltd_models_df[row_ix, "variable"]), "[.]")), 1))
mltd_models_df$label <- sapply(1:nrow(mltd_models_df),
function(row_ix) head(unlist(strsplit(as.character(
mltd_models_df[row_ix, "variable"]),
paste0(".", mltd_models_df[row_ix, "data"]))), 1))
#print(mltd_models_df)
return(mltd_models_df)
}
mltd_models_df <- build_statsCI_data(plt_models_df)
mltdCI_models_df <- melt(pltCI_models_df, id.vars="id")
for (row_ix in 1:nrow(mltdCI_models_df)) {
for (type in c("Upper", "Lower")) {
if (length(var_components <- unlist(strsplit(
as.character(mltdCI_models_df[row_ix, "variable"]), type))) > 1) {
#print(sprintf("row_ix:%d; type:%s; ", row_ix, type))
mltdCI_models_df[row_ix, "label"] <- var_components[1]
mltdCI_models_df[row_ix, "data"] <-
unlist(strsplit(var_components[2], "[.]"))[2]
mltdCI_models_df[row_ix, "type"] <- type
break
}
}
}
wideCI_models_df <- reshape(subset(mltdCI_models_df, select=-variable),
timevar="type",
idvar=setdiff(names(mltdCI_models_df), c("type", "value", "variable")),
direction="wide")
#print(wideCI_models_df)
mrgdCI_models_df <- merge(wideCI_models_df, mltd_models_df, all.x=TRUE)
#print(mrgdCI_models_df)
# Merge stats back in if CIs don't exist
goback_vars <- c()
for (var in unique(mltd_models_df$label)) {
for (type in unique(mltd_models_df$data)) {
var_type <- paste0(var, ".", type)
# if this data is already present, next
if (var_type %in% unique(paste(mltd_models_df$label, mltd_models_df$data,
sep=".")))
next
#print(sprintf("var_type:%s", var_type))
goback_vars <- c(goback_vars, var_type)
}
}
if (length(goback_vars) > 0) {
mltd_goback_df <- build_statsCI_data(glb_models_df[, c("id", goback_vars)])
mltd_models_df <- rbind(mltd_models_df, mltd_goback_df)
}
# mltd_models_df <- merge(mltd_models_df, glb_models_df[, c("id", "model_method")],
# all.x=TRUE)
png(paste0(glbOut$pfx, "models_bar.png"), width=480*3, height=480*2)
#print(gp <- myplot_bar(mltd_models_df, "id", "value", colorcol_name="model_method") +
print(gp <- myplot_bar(df=mltd_models_df, xcol_name="id", ycol_names="value") +
geom_errorbar(data=mrgdCI_models_df,
mapping=aes(x=mdl_id, ymax=value.Upper, ymin=value.Lower), width=0.5) +
facet_grid(label ~ data, scales="free") +
theme(axis.text.x = element_text(angle = 90,vjust = 0.5)))
## Warning: Removed 4 rows containing missing values (geom_errorbar).
dev.off()
## quartz_off_screen
## 2
print(gp)
## Warning: Removed 4 rows containing missing values (geom_errorbar).
dsp_models_cols <- c("id",
glbMdlMetricsEval[glbMdlMetricsEval %in% names(glb_models_df)],
grep("opt.", names(glb_models_df), fixed = TRUE, value = TRUE))
# if (glb_is_classification && glb_is_binomial)
# dsp_models_cols <- c(dsp_models_cols, "opt.prob.threshold.OOB")
print(dsp_models_df <- orderBy(get_model_sel_frmla(), glb_models_df)[, dsp_models_cols])
## id max.Accuracy.OOB max.AUCROCR.OOB
## 8 All.X##rcv#glm 0.5354260 0.4500685
## 6 Low.cor.X##rcv#glmnet 0.5345291 0.4412078
## 7 All.X##rcv#glmnet 0.5345291 0.4412078
## 2 Random###myrandom_classfr 0.5300448 0.5178149
## 1 MFO###myMFO_classfr 0.5300448 0.5000000
## 4 Max.cor.Y##rcv#rpart 0.5300448 0.4999354
## 3 Max.cor.Y.rcv.1X1###glmnet 0.5300448 0.4910312
## 5 Interact.High.cor.Y##rcv#glmnet 0.5300448 0.4731743
## max.AUCpROC.OOB max.Accuracy.fit opt.prob.threshold.fit
## 8 0.5360836 0.6305879 0.40
## 6 0.5457838 0.6543941 0.45
## 7 0.5457838 0.6543941 0.45
## 2 0.5268661 0.5299798 0.00
## 1 0.5000000 0.5299798 0.00
## 4 0.4999322 0.6227314 0.00
## 3 0.4999322 0.5299798 0.00
## 5 0.5157790 0.6276719 0.35
## opt.prob.threshold.OOB
## 8 0.1
## 6 0.2
## 7 0.2
## 2 0.0
## 1 0.0
## 4 0.0
## 3 0.0
## 5 0.0
# print(myplot_radar(radar_inp_df = dsp_models_df))
print("Metrics used for model selection:"); print(get_model_sel_frmla())
## [1] "Metrics used for model selection:"
## ~-max.Accuracy.OOB - max.AUCROCR.OOB - max.AUCpROC.OOB - max.Accuracy.fit -
## opt.prob.threshold.OOB
## <environment: 0x7fc037e359c8>
print(sprintf("Best model id: %s", dsp_models_df[1, "id"]))
## [1] "Best model id: All.X##rcv#glm"
glb_get_predictions <- function(df, mdl_id, rsp_var, prob_threshold_def=NULL, verbose=FALSE) {
mdl <- glb_models_lst[[mdl_id]]
clmnNames <- mygetPredictIds(rsp_var, mdl_id)
predct_var_name <- clmnNames$value
predct_prob_var_name <- clmnNames$prob
predct_accurate_var_name <- clmnNames$is.acc
predct_error_var_name <- clmnNames$err
predct_erabs_var_name <- clmnNames$err.abs
if (glb_is_regression) {
df[, predct_var_name] <- predict(mdl, newdata=df, type="raw")
if (verbose) print(myplot_scatter(df, glb_rsp_var, predct_var_name) +
facet_wrap(reformulate(glbFeatsCategory), scales = "free") +
stat_smooth(method="glm"))
df[, predct_error_var_name] <- df[, predct_var_name] - df[, glb_rsp_var]
if (verbose) print(myplot_scatter(df, predct_var_name, predct_error_var_name) +
#facet_wrap(reformulate(glbFeatsCategory), scales = "free") +
stat_smooth(method="auto"))
if (verbose) print(myplot_scatter(df, glb_rsp_var, predct_error_var_name) +
#facet_wrap(reformulate(glbFeatsCategory), scales = "free") +
stat_smooth(method="glm"))
df[, predct_erabs_var_name] <- abs(df[, predct_error_var_name])
if (verbose) print(head(orderBy(reformulate(c("-", predct_erabs_var_name)), df)))
df[, predct_accurate_var_name] <- (df[, glb_rsp_var] == df[, predct_var_name])
}
if (glb_is_classification && glb_is_binomial) {
prob_threshold <- glb_models_df[glb_models_df$id == mdl_id,
"opt.prob.threshold.OOB"]
if (is.null(prob_threshold) || is.na(prob_threshold)) {
warning("Using default probability threshold: ", prob_threshold_def)
if (is.null(prob_threshold <- prob_threshold_def))
stop("Default probability threshold is NULL")
}
df[, predct_prob_var_name] <- predict(mdl, newdata = df, type = "prob")[, 2]
df[, predct_var_name] <-
factor(levels(df[, glb_rsp_var])[
(df[, predct_prob_var_name] >=
prob_threshold) * 1 + 1], levels(df[, glb_rsp_var]))
# if (verbose) print(myplot_scatter(df, glb_rsp_var, predct_var_name) +
# facet_wrap(reformulate(glbFeatsCategory), scales = "free") +
# stat_smooth(method="glm"))
df[, predct_error_var_name] <- df[, predct_var_name] != df[, glb_rsp_var]
# if (verbose) print(myplot_scatter(df, predct_var_name, predct_error_var_name) +
# #facet_wrap(reformulate(glbFeatsCategory), scales = "free") +
# stat_smooth(method="auto"))
# if (verbose) print(myplot_scatter(df, glb_rsp_var, predct_error_var_name) +
# #facet_wrap(reformulate(glbFeatsCategory), scales = "free") +
# stat_smooth(method="glm"))
# if prediction is a TP (true +ve), measure distance from 1.0
tp <- which((df[, predct_var_name] == df[, glb_rsp_var]) &
(df[, predct_var_name] == levels(df[, glb_rsp_var])[2]))
df[tp, predct_erabs_var_name] <- abs(1 - df[tp, predct_prob_var_name])
#rowIx <- which.max(df[tp, predct_erabs_var_name]); df[tp, c(glbFeatsId, glb_rsp_var, predct_var_name, predct_prob_var_name, predct_erabs_var_name)][rowIx, ]
# if prediction is a TN (true -ve), measure distance from 0.0
tn <- which((df[, predct_var_name] == df[, glb_rsp_var]) &
(df[, predct_var_name] == levels(df[, glb_rsp_var])[1]))
df[tn, predct_erabs_var_name] <- abs(0 - df[tn, predct_prob_var_name])
#rowIx <- which.max(df[tn, predct_erabs_var_name]); df[tn, c(glbFeatsId, glb_rsp_var, predct_var_name, predct_prob_var_name, predct_erabs_var_name)][rowIx, ]
# if prediction is a FP (flse +ve), measure distance from 0.0
fp <- which((df[, predct_var_name] != df[, glb_rsp_var]) &
(df[, predct_var_name] == levels(df[, glb_rsp_var])[2]))
df[fp, predct_erabs_var_name] <- abs(0 - df[fp, predct_prob_var_name])
#rowIx <- which.max(df[fp, predct_erabs_var_name]); df[fp, c(glbFeatsId, glb_rsp_var, predct_var_name, predct_prob_var_name, predct_erabs_var_name)][rowIx, ]
# if prediction is a FN (flse -ve), measure distance from 1.0
fn <- which((df[, predct_var_name] != df[, glb_rsp_var]) &
(df[, predct_var_name] == levels(df[, glb_rsp_var])[1]))
df[fn, predct_erabs_var_name] <- abs(1 - df[fn, predct_prob_var_name])
#rowIx <- which.max(df[fn, predct_erabs_var_name]); df[fn, c(glbFeatsId, glb_rsp_var, predct_var_name, predct_prob_var_name, predct_erabs_var_name)][rowIx, ]
if (verbose) print(head(orderBy(reformulate(c("-", predct_erabs_var_name)), df)))
df[, predct_accurate_var_name] <- (df[, glb_rsp_var] == df[, predct_var_name])
}
if (glb_is_classification && !glb_is_binomial) {
df[, predct_var_name] <- predict(mdl, newdata = df, type = "raw")
probCls <- predict(mdl, newdata = df, type = "prob")
df[, predct_prob_var_name] <- NA
for (cls in names(probCls)) {
mask <- (df[, predct_var_name] == cls)
df[mask, predct_prob_var_name] <- probCls[mask, cls]
}
if (verbose) print(myplot_histogram(df, predct_prob_var_name,
fill_col_name = predct_var_name))
if (verbose) print(myplot_histogram(df, predct_prob_var_name,
facet_frmla = paste0("~", glb_rsp_var)))
df[, predct_error_var_name] <- df[, predct_var_name] != df[, glb_rsp_var]
# if prediction is erroneous, measure predicted class prob from actual class prob
df[, predct_erabs_var_name] <- 0
for (cls in names(probCls)) {
mask <- (df[, glb_rsp_var] == cls) & (df[, predct_error_var_name])
df[mask, predct_erabs_var_name] <- probCls[mask, cls]
}
df[, predct_accurate_var_name] <- (df[, glb_rsp_var] == df[, predct_var_name])
}
return(df)
}
#stop(here"); glb2Sav(); glbObsAll <- savObsAll; glbObsTrn <- savObsTrn; glbObsFit <- savObsFit; glbObsOOB <- savObsOOB; sav_models_df <- glb_models_df; glb_models_df <- sav_models_df; glb_featsimp_df <- sav_featsimp_df
myget_category_stats <- function(obs_df, mdl_id, label) {
require(dplyr)
require(lazyeval)
predct_var_name <- mygetPredictIds(glb_rsp_var, mdl_id)$value
predct_error_var_name <- mygetPredictIds(glb_rsp_var, mdl_id)$err.abs
if (!predct_var_name %in% names(obs_df))
obs_df <- glb_get_predictions(obs_df, mdl_id, glb_rsp_var)
tmp_obs_df <- obs_df[, c(glbFeatsCategory, glb_rsp_var,
predct_var_name, predct_error_var_name)]
# tmp_obs_df <- obs_df %>%
# dplyr::select_(glbFeatsCategory, glb_rsp_var, predct_var_name, predct_error_var_name)
#dplyr::rename(startprice.log10.predict.RFE.X.glmnet.err=error_abs_OOB)
names(tmp_obs_df)[length(names(tmp_obs_df))] <- paste0("err.abs.", label)
ret_ctgry_df <- tmp_obs_df %>%
dplyr::group_by_(glbFeatsCategory) %>%
dplyr::summarise_(#interp(~sum(abs(var)), var=as.name(glb_rsp_var)),
interp(~sum(var), var=as.name(paste0("err.abs.", label))),
interp(~mean(var), var=as.name(paste0("err.abs.", label))),
interp(~n()))
names(ret_ctgry_df) <- c(glbFeatsCategory,
#paste0(glb_rsp_var, ".abs.", label, ".sum"),
paste0("err.abs.", label, ".sum"),
paste0("err.abs.", label, ".mean"),
paste0(".n.", label))
ret_ctgry_df <- dplyr::ungroup(ret_ctgry_df)
#colSums(ret_ctgry_df[, -grep(glbFeatsCategory, names(ret_ctgry_df))])
return(ret_ctgry_df)
}
#print(colSums((ctgry_df <- myget_category_stats(obs_df=glbObsFit, mdl_id="", label="fit"))[, -grep(glbFeatsCategory, names(ctgry_df))]))
if (!is.null(glb_mdl_ensemble)) {
fit.models_2_chunk_df <- myadd_chunk(fit.models_2_chunk_df,
paste0("fit.models_2_", mdl_id_pfx), major.inc = TRUE,
label.minor = "ensemble")
mdl_id_pfx <- "Ensemble"
if (#(glb_is_regression) |
((glb_is_classification) & (!glb_is_binomial)))
stop("Ensemble models not implemented yet for multinomial classification")
mygetEnsembleAutoMdlIds <- function() {
tmp_models_df <- orderBy(get_model_sel_frmla(), glb_models_df)
row.names(tmp_models_df) <- tmp_models_df$id
mdl_threshold_pos <-
min(which(grepl("MFO|Random|Baseline", tmp_models_df$id))) - 1
mdlIds <- tmp_models_df$id[1:mdl_threshold_pos]
return(mdlIds[!grepl("Ensemble", mdlIds)])
}
if (glb_mdl_ensemble == "auto") {
glb_mdl_ensemble <- mygetEnsembleAutoMdlIds()
mdl_id_pfx <- paste0(mdl_id_pfx, ".auto")
} else if (grepl("^%<d-%", glb_mdl_ensemble)) {
glb_mdl_ensemble <- eval(parse(text =
str_trim(unlist(strsplit(glb_mdl_ensemble, "%<d-%"))[2])))
}
for (mdl_id in glb_mdl_ensemble) {
if (!(mdl_id %in% names(glb_models_lst))) {
warning("Model ", mdl_id, " in glb_model_ensemble not found !")
next
}
glbObsFit <- glb_get_predictions(df = glbObsFit, mdl_id, glb_rsp_var)
glbObsOOB <- glb_get_predictions(df = glbObsOOB, mdl_id, glb_rsp_var)
}
#mdl_id_pfx <- "Ensemble.RFE"; mdlId <- paste0(mdl_id_pfx, ".glmnet")
#glb_mdl_ensemble <- gsub(mygetPredictIds$value, "", grep("RFE\\.X\\.(?!Interact)", row.names(glb_featsimp_df), perl = TRUE, value = TRUE), fixed = TRUE)
#varImp(glb_models_lst[[mdlId]])
#cor_df <- data.frame(cor=cor(glbObsFit[, glb_rsp_var], glbObsFit[, paste(mygetPredictIds$value, glb_mdl_ensemble)], use="pairwise.complete.obs"))
#glbObsFit <- glb_get_predictions(df=glbObsFit, "Ensemble.glmnet", glb_rsp_var);print(colSums((ctgry_df <- myget_category_stats(obs_df=glbObsFit, mdl_id="Ensemble.glmnet", label="fit"))[, -grep(glbFeatsCategory, names(ctgry_df))]))
### bid0_sp
# Better than MFO; models.n=28; min.RMSE.fit=0.0521233; err.abs.fit.sum=7.3631895
# old: Top x from auto; models.n= 5; min.RMSE.fit=0.06311047; err.abs.fit.sum=9.5937080
# RFE only ; models.n=16; min.RMSE.fit=0.05148588; err.abs.fit.sum=7.2875091
# RFE subset only ;models.n= 5; min.RMSE.fit=0.06040702; err.abs.fit.sum=9.059088
# RFE subset only ;models.n= 9; min.RMSE.fit=0.05933167; err.abs.fit.sum=8.7421288
# RFE subset only ;models.n=15; min.RMSE.fit=0.0584607; err.abs.fit.sum=8.5902066
# RFE subset only ;models.n=17; min.RMSE.fit=0.05496899; err.abs.fit.sum=8.0170431
# RFE subset only ;models.n=18; min.RMSE.fit=0.05441577; err.abs.fit.sum=7.837223
# RFE subset only ;models.n=16; min.RMSE.fit=0.05441577; err.abs.fit.sum=7.837223
### bid0_sp
### bid1_sp
# "auto"; err.abs.fit.sum=76.699774; min.RMSE.fit=0.2186429
# "RFE.X.*"; err.abs.fit.sum=; min.RMSE.fit=0.221114
### bid1_sp
indepVar <- paste(mygetPredictIds(glb_rsp_var)$value, glb_mdl_ensemble, sep = "")
if (glb_is_classification)
indepVar <- paste(indepVar, ".prob", sep = "")
# Some models in glb_mdl_ensemble might not be fitted e.g. RFE.X.Interact
indepVar <- intersect(indepVar, names(glbObsFit))
# indepVar <- grep(mygetPredictIds(glb_rsp_var)$value, names(glbObsFit), fixed=TRUE, value=TRUE)
# if (glb_is_regression)
# indepVar <- indepVar[!grepl("(err\\.abs|accurate)$", indepVar)]
# if (glb_is_classification && glb_is_binomial)
# indepVar <- grep("prob$", indepVar, value=TRUE) else
# indepVar <- indepVar[!grepl("err$", indepVar)]
#rfe_fit_ens_results <- myrun_rfe(glbObsFit, indepVar)
for (method in c("glm", "glmnet")) {
for (trainControlMethod in
c("boot", "boot632", "cv", "repeatedcv"
#, "LOOCV" # tuneLength * nrow(fitDF)
, "LGOCV", "adaptive_cv"
#, "adaptive_boot" #error: adaptive$min should be less than 3
#, "adaptive_LGOCV" #error: adaptive$min should be less than 3
)) {
#sav_models_df <- glb_models_df; all.equal(sav_models_df, glb_models_df)
#glb_models_df <- sav_models_df; print(glb_models_df$id)
if ((method == "glm") && (trainControlMethod != "repeatedcv"))
# glm used only to identify outliers
next
ret_lst <- myfit_mdl(
mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = paste0(mdl_id_pfx, ".", trainControlMethod),
type = glb_model_type, tune.df = NULL,
trainControl.method = trainControlMethod,
trainControl.number = glb_rcv_n_folds,
trainControl.repeats = glb_rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize,
train.method = method)),
indepVar = indepVar, rsp_var = glb_rsp_var,
fit_df = glbObsFit, OOB_df = glbObsOOB)
}
}
dsp_models_df <- get_dsp_models_df()
}
if (is.null(glbMdlSelId))
glbMdlSelId <- dsp_models_df[1, "id"] else
print(sprintf("User specified selection: %s", glbMdlSelId))
## [1] "User specified selection: All.X##rcv#glmnet"
myprint_mdl(glb_sel_mdl <- glb_models_lst[[glbMdlSelId]])
## Length Class Mode
## a0 92 -none- numeric
## beta 22724 dgCMatrix S4
## df 92 -none- numeric
## dim 2 -none- numeric
## lambda 92 -none- numeric
## dev.ratio 92 -none- numeric
## nulldev 1 -none- numeric
## npasses 1 -none- numeric
## jerr 1 -none- numeric
## offset 1 -none- logical
## classnames 2 -none- character
## call 5 -none- call
## nobs 1 -none- numeric
## lambdaOpt 1 -none- numeric
## xNames 247 -none- character
## problemType 1 -none- character
## tuneValue 2 data.frame list
## obsLevels 2 -none- character
## [1] "min lambda > lambdaOpt:"
## (Intercept) .rnorm
## 0.2086644068 -0.0040676082
## Edn.fctr.L Edn.fctr^6
## 0.0807593733 0.0037049998
## Edn.fctr^7 Gender.fctrF
## 0.0109130085 0.0175273672
## Gender.fctrM Hhold.fctrMKy
## -0.0975008166 -0.0917112139
## Hhold.fctrPKn Hhold.fctrSKy
## 0.4801925403 0.0860632190
## Income.fctr.Q Income.fctr.C
## -0.1167443486 -0.0618266878
## Q100689.fctrYes Q101163.fctrDad
## 0.0916223483 -0.1174179957
## Q101163.fctrMom Q101596.fctrYes
## 0.0690167583 -0.0149916083
## Q102089.fctrRent Q102687.fctrYes
## 0.0397274885 0.0236799740
## Q104996.fctrNo Q104996.fctrYes
## -0.0384366155 0.0082970435
## Q105655.fctrYes Q105840.fctrNo
## -0.0103747720 -0.0108299455
## Q105840.fctrYes Q106042.fctrNo
## 0.0336072662 -0.0681056248
## Q106388.fctrYes Q106389.fctrNo
## -0.0222148609 -0.0341247333
## Q106997.fctrGr Q107869.fctrNo
## -0.0410948349 0.0062341950
## Q108342.fctrOnline Q108754.fctrYes
## 0.0482821727 -0.0332250858
## Q108855.fctrYes! Q108856.fctrSocialize
## -0.0244465573 -0.0298124454
## Q109244.fctrNo Q109244.fctrYes
## -0.4233306042 0.8673728628
## Q109367.fctrYes Q110740.fctrPC
## 0.0075309573 -0.0812633625
## Q111220.fctrNo Q111220.fctrYes
## -0.0028992659 0.0548562552
## Q111848.fctrYes Q112270.fctrNo
## 0.0422254964 0.0003926562
## Q112478.fctrNo Q113181.fctrNo
## -0.0287283353 0.1208500531
## Q113181.fctrYes Q113583.fctrTunes
## -0.1721653557 0.0191272307
## Q113992.fctrYes Q114517.fctrNo
## 0.0026477157 0.0298295402
## Q115195.fctrNo Q115195.fctrYes
## -0.0079655514 0.0274792793
## Q115390.fctrYes Q115610.fctrNo
## 0.0433150081 -0.0192191439
## Q115611.fctrNo Q115611.fctrYes
## 0.1197804457 -0.2812318027
## Q115899.fctrCs Q115899.fctrMe
## 0.0713773936 -0.0289640943
## Q116197.fctrA.M. Q116881.fctrHappy
## -0.0110939396 0.0144345169
## Q116881.fctrRight Q116953.fctrNo
## -0.1586375438 -0.0604468028
## Q118117.fctrYes Q118232.fctrId
## -0.0356424665 0.0967572276
## Q118233.fctrNo Q118892.fctrNo
## -0.0476696274 -0.0101337298
## Q119851.fctrNo Q119851.fctrYes
## -0.0747510956 0.0896931372
## Q120012.fctrYes Q120014.fctrNo
## 0.0266469396 0.0108260492
## Q120014.fctrYes Q120194.fctrStudy first
## -0.0071405452 0.0010046252
## Q120379.fctrNo Q120379.fctrYes
## -0.0230881465 0.0722805146
## Q120472.fctrScience Q120650.fctrNo
## -0.0777170361 0.0115894753
## Q121699.fctrYes Q122120.fctrYes
## 0.0566089666 -0.0707418237
## Q122771.fctrPt Q123621.fctrYes
## -0.0962320118 -0.0018081407
## Q124122.fctrNo Q124742.fctrNo
## -0.0088367827 0.0311087872
## Q98059.fctrOnly-child Q98059.fctrYes
## -0.0379123244 0.0373348517
## Q98197.fctrNo Q98197.fctrYes
## 0.1656648663 -0.1218575980
## Q98869.fctrNo Q99480.fctrNo
## 0.2533897602 0.1223858992
## Q99480.fctrYes Q99716.fctrYes
## -0.0522373638 0.0479268633
## YOB.Age.fctr.L YOB.Age.fctr^8
## 0.0939646970 -0.0340229370
## Q109244.fctrYes:.clusterid.fctr2 Q109244.fctrNo:.clusterid.fctr3
## 0.1462699802 -0.0267021748
## Q109244.fctrYes:.clusterid.fctr3 YOB.Age.fctr(30,35]:YOB.Age.dff
## 0.6434456849 -0.0054183207
## YOB.Age.fctr(35,40]:YOB.Age.dff YOB.Age.fctr(40,50]:YOB.Age.dff
## 0.0714364573 -0.0003430897
## [1] "max lambda < lambdaOpt:"
## (Intercept) .rnorm
## 0.2133116408 -0.0063580846
## Edn.fctr.L Edn.fctr^4
## 0.0855088630 -0.0006733155
## Edn.fctr^6 Edn.fctr^7
## 0.0104415796 0.0169153579
## Gender.fctrF Gender.fctrM
## 0.0120614113 -0.0998204566
## Hhold.fctrMKy Hhold.fctrPKn
## -0.0971229287 0.4982311801
## Hhold.fctrSKy Income.fctr.Q
## 0.0980579205 -0.1236872013
## Income.fctr.C Q100689.fctrYes
## -0.0721016259 0.0991483660
## Q101162.fctrPessimist Q101163.fctrDad
## -0.0021383985 -0.1222799255
## Q101163.fctrMom Q101596.fctrYes
## 0.0708708260 -0.0194907319
## Q102089.fctrRent Q102687.fctrYes
## 0.0430274966 0.0302665215
## Q102906.fctrYes Q104996.fctrNo
## -0.0053679772 -0.0428684755
## Q104996.fctrYes Q105655.fctrYes
## 0.0129695841 -0.0156314570
## Q105840.fctrNo Q105840.fctrYes
## -0.0087099928 0.0363178280
## Q106042.fctrNo Q106388.fctrYes
## -0.0714315958 -0.0258114314
## Q106389.fctrNo Q106997.fctrGr
## -0.0405401997 -0.0477850922
## Q107869.fctrNo Q108342.fctrOnline
## 0.0123815444 0.0541889369
## Q108754.fctrYes Q108855.fctrYes!
## -0.0395679490 -0.0286372736
## Q108856.fctrSocialize Q109244.fctrNo
## -0.0366184596 -0.4304273946
## Q109244.fctrYes Q109367.fctrYes
## 0.8859332171 0.0096264253
## Q110740.fctrMac Q110740.fctrPC
## 0.0016062166 -0.0871089509
## Q111220.fctrNo Q111220.fctrYes
## -0.0064779703 0.0602733531
## Q111848.fctrYes Q112270.fctrNo
## 0.0489308979 0.0041590948
## Q112478.fctrNo Q113181.fctrNo
## -0.0336132254 0.1222078279
## Q113181.fctrYes Q113583.fctrTunes
## -0.1769077838 0.0232944887
## Q113992.fctrYes Q114517.fctrNo
## 0.0093114211 0.0363977845
## Q115195.fctrNo Q115195.fctrYes
## -0.0117013636 0.0300167127
## Q115390.fctrYes Q115610.fctrNo
## 0.0493692970 -0.0264929967
## Q115611.fctrNo Q115611.fctrYes
## 0.1195966557 -0.2886833828
## Q115899.fctrCs Q115899.fctrMe
## 0.0767471002 -0.0310474147
## Q116197.fctrA.M. Q116881.fctrHappy
## -0.0178577032 0.0186990229
## Q116881.fctrRight Q116953.fctrNo
## -0.1627119311 -0.0678083129
## Q118117.fctrYes Q118232.fctrId
## -0.0384748338 0.1049607291
## Q118233.fctrNo Q118892.fctrNo
## -0.0551602210 -0.0116647542
## Q119851.fctrNo Q119851.fctrYes
## -0.0785778058 0.0939051159
## Q120012.fctrYes Q120014.fctrNo
## 0.0314354375 0.0133418508
## Q120014.fctrYes Q120194.fctrStudy first
## -0.0095710830 0.0046369879
## Q120379.fctrNo Q120379.fctrYes
## -0.0264476527 0.0781396918
## Q120472.fctrScience Q120650.fctrNo
## -0.0831398605 0.0214397919
## Q121011.fctrNo Q121011.fctrYes
## -0.0006193183 0.0007349370
## Q121699.fctrYes Q122120.fctrYes
## 0.0621928559 -0.0787327327
## Q122771.fctrPt Q123621.fctrYes
## -0.1051539163 -0.0071296472
## Q124122.fctrNo Q124742.fctrNo
## -0.0139014911 0.0398117762
## Q96024.fctrNo Q98059.fctrOnly-child
## 0.0042966064 -0.0512494295
## Q98059.fctrYes Q98197.fctrNo
## 0.0448973136 0.1689994948
## Q98197.fctrYes Q98869.fctrNo
## -0.1250279025 0.2630244707
## Q99480.fctrNo Q99480.fctrYes
## 0.1266614399 -0.0591442546
## Q99716.fctrYes YOB.Age.fctr.L
## 0.0505441934 0.1052236239
## YOB.Age.fctr.Q YOB.Age.fctr^8
## 0.0055981032 -0.0341534347
## Q109244.fctrYes:.clusterid.fctr2 Q109244.fctrNo:.clusterid.fctr3
## 0.1463559578 -0.0262516542
## Q109244.fctrYes:.clusterid.fctr3 YOB.Age.fctr(30,35]:YOB.Age.dff
## 0.6643435951 -0.0080024138
## YOB.Age.fctr(35,40]:YOB.Age.dff YOB.Age.fctr(40,50]:YOB.Age.dff
## 0.0754472783 -0.0017757125
## [1] TRUE
# From here to save(), this should all be in one function
# these are executed in the same seq twice more:
# fit.data.training & predict.data.new chunks
print(sprintf("%s fit prediction diagnostics:", glbMdlSelId))
## [1] "All.X##rcv#glmnet fit prediction diagnostics:"
glbObsFit <- glb_get_predictions(df = glbObsFit, mdl_id = glbMdlSelId,
rsp_var = glb_rsp_var)
print(sprintf("%s OOB prediction diagnostics:", glbMdlSelId))
## [1] "All.X##rcv#glmnet OOB prediction diagnostics:"
glbObsOOB <- glb_get_predictions(df = glbObsOOB, mdl_id = glbMdlSelId,
rsp_var = glb_rsp_var)
print(glb_featsimp_df <- myget_feats_importance(mdl = glb_sel_mdl, featsimp_df = NULL))
## All.X..rcv.glmnet.imp imp
## Q109244.fctrYes 100.00000000 100.00000000
## Q109244.fctrYes:.clusterid.fctr3 74.83524172 74.83524172
## Hhold.fctrPKn 56.07166248 56.07166248
## Q109244.fctrNo 48.62666730 48.62666730
## Q115611.fctrYes 32.55451130 32.55451130
## Q98869.fctrNo 29.59870981 29.59870981
## Q113181.fctrYes 19.94584594 19.94584594
## Q98197.fctrNo 19.08037962 19.08037962
## Q116881.fctrRight 18.35159601 18.35159601
## Q109244.fctrYes:.clusterid.fctr2 16.58519910 16.58519910
## Q99480.fctrNo 14.26145355 14.26145355
## Q98197.fctrYes 14.10050710 14.10050710
## Income.fctr.Q 13.86599639 13.86599639
## Q113181.fctrNo 13.82056528 13.82056528
## Q101163.fctrDad 13.75204636 13.75204636
## Q115611.fctrNo 13.55836897 13.55836897
## Q122771.fctrPt 11.72223583 11.72223583
## Q118232.fctrId 11.71606377 11.71606377
## YOB.Age.fctr.L 11.67898928 11.67898928
## Gender.fctrM 11.26226797 11.26226797
## Q100689.fctrYes 11.07215345 11.07215345
## Hhold.fctrMKy 10.88887536 10.88887536
## Hhold.fctrSKy 10.85076994 10.85076994
## Q119851.fctrYes 10.55044508 10.55044508
## Q110740.fctrPC 9.74445742 9.74445742
## Edn.fctr.L 9.58710195 9.58710195
## Q120472.fctrScience 9.30387759 9.30387759
## Q119851.fctrNo 8.82177415 8.82177415
## Q122120.fctrYes 8.74819725 8.74819725
## Q120379.fctrYes 8.72763956 8.72763956
## Q115899.fctrCs 8.58052411 8.58052411
## YOB.Age.fctr(35,40]:YOB.Age.dff 8.46295014 8.46295014
## Q106042.fctrNo 8.02282573 8.02282573
## Q101163.fctrMom 7.99148480 7.99148480
## Income.fctr.C 7.94668154 7.94668154
## Q116953.fctrNo 7.52386562 7.52386562
## Q121699.fctrYes 6.92634843 6.92634843
## Q111220.fctrYes 6.71245413 6.71245413
## Q99480.fctrYes 6.55188429 6.55188429
## Q118233.fctrNo 6.08758392 6.08758392
## Q108342.fctrOnline 6.01216739 6.01216739
## Q99716.fctrYes 5.67108541 5.67108541
## Q98059.fctrOnly-child 5.51640543 5.51640543
## Q115390.fctrYes 5.46271052 5.46271052
## Q111848.fctrYes 5.39877518 5.39877518
## Q106997.fctrGr 5.26924807 5.26924807
## Q98059.fctrYes 4.92287648 4.92287648
## Q102089.fctrRent 4.80424869 4.80424869
## Q104996.fctrNo 4.76145512 4.76145512
## Q106389.fctrNo 4.45417061 4.45417061
## Q108754.fctrYes 4.34557066 4.34557066
## Q124742.fctrNo 4.32155212 4.32155212
## Q118117.fctrYes 4.29851252 4.29851252
## Q105840.fctrYes 4.05671656 4.05671656
## Q108856.fctrSocialize 4.00115748 4.00115748
## Q114517.fctrNo 3.98135122 3.98135122
## YOB.Age.fctr^8 3.86788345 3.86788345
## Q112478.fctrNo 3.70260744 3.70260744
## Q115899.fctrMe 3.47312792 3.47312792
## Q120012.fctrYes 3.45790000 3.45790000
## Q115195.fctrYes 3.34637604 3.34637604
## Q102687.fctrYes 3.28607116 3.28607116
## Q108855.fctrYes! 3.15385609 3.15385609
## Q109244.fctrNo:.clusterid.fctr3 2.98506027 2.98506027
## Q120379.fctrNo 2.92388939 2.92388939
## Q106388.fctrYes 2.84659573 2.84659573
## Q115610.fctrNo 2.84336116 2.84336116
## Q113583.fctrTunes 2.54885123 2.54885123
## Q120650.fctrNo 2.21427505 2.21427505
## Q101596.fctrYes 2.11049389 2.11049389
## Q116881.fctrHappy 2.02590119 2.02590119
## Q116197.fctrA.M. 1.87585384 1.87585384
## Edn.fctr^7 1.78571813 1.78571813
## Q105655.fctrYes 1.65652793 1.65652793
## Gender.fctrF 1.48659080 1.48659080
## Q124122.fctrNo 1.46466576 1.46466576
## Q120014.fctrNo 1.45702356 1.45702356
## Q104996.fctrYes 1.36763194 1.36763194
## Q118892.fctrNo 1.28850407 1.28850407
## Q107869.fctrNo 1.26871030 1.26871030
## Q115195.fctrNo 1.24440039 1.24440039
## Q109367.fctrYes 1.04513935 1.04513935
## Edn.fctr^6 1.03595109 1.03595109
## Q105840.fctrNo 1.03353293 1.03353293
## Q120014.fctrYes 1.03153405 1.03153405
## Q113992.fctrYes 0.90946080 0.90946080
## YOB.Age.fctr(30,35]:YOB.Age.dff 0.85039014 0.85039014
## Q123621.fctrYes 0.69156664 0.69156664
## .rnorm 0.67045796 0.67045796
## Q111220.fctrNo 0.65585161 0.65585161
## YOB.Age.fctr.Q 0.51193745 0.51193745
## Q102906.fctrYes 0.49089280 0.49089280
## Q120194.fctrStudy first 0.44603169 0.44603169
## Q96024.fctrNo 0.39291769 0.39291769
## Q112270.fctrNo 0.38893593 0.38893593
## Q101162.fctrPessimist 0.19555307 0.19555307
## YOB.Age.fctr(40,50]:YOB.Age.dff 0.16989470 0.16989470
## Q110740.fctrMac 0.14688590 0.14688590
## Q121011.fctrYes 0.06720879 0.06720879
## Edn.fctr^4 0.06157361 0.06157361
## Q121011.fctrNo 0.05663566 0.05663566
## Edn.fctr.Q 0.00000000 0.00000000
## Edn.fctr.C 0.00000000 0.00000000
## Edn.fctr^5 0.00000000 0.00000000
## Hhold.fctrMKn 0.00000000 0.00000000
## Hhold.fctrPKy 0.00000000 0.00000000
## Hhold.fctrSKn 0.00000000 0.00000000
## Income.fctr.L 0.00000000 0.00000000
## Income.fctr^4 0.00000000 0.00000000
## Income.fctr^5 0.00000000 0.00000000
## Income.fctr^6 0.00000000 0.00000000
## Q100010.fctrNo 0.00000000 0.00000000
## Q100010.fctrYes 0.00000000 0.00000000
## Q100562.fctrNo 0.00000000 0.00000000
## Q100562.fctrYes 0.00000000 0.00000000
## Q100680.fctrNo 0.00000000 0.00000000
## Q100680.fctrYes 0.00000000 0.00000000
## Q100689.fctrNo 0.00000000 0.00000000
## Q101162.fctrOptimist 0.00000000 0.00000000
## Q101596.fctrNo 0.00000000 0.00000000
## Q102089.fctrOwn 0.00000000 0.00000000
## Q102289.fctrNo 0.00000000 0.00000000
## Q102289.fctrYes 0.00000000 0.00000000
## Q102674.fctrNo 0.00000000 0.00000000
## Q102674.fctrYes 0.00000000 0.00000000
## Q102687.fctrNo 0.00000000 0.00000000
## Q102906.fctrNo 0.00000000 0.00000000
## Q103293.fctrNo 0.00000000 0.00000000
## Q103293.fctrYes 0.00000000 0.00000000
## Q105655.fctrNo 0.00000000 0.00000000
## Q106042.fctrYes 0.00000000 0.00000000
## Q106272.fctrNo 0.00000000 0.00000000
## Q106272.fctrYes 0.00000000 0.00000000
## Q106388.fctrNo 0.00000000 0.00000000
## Q106389.fctrYes 0.00000000 0.00000000
## Q106993.fctrNo 0.00000000 0.00000000
## Q106993.fctrYes 0.00000000 0.00000000
## Q106997.fctrYy 0.00000000 0.00000000
## Q107491.fctrNo 0.00000000 0.00000000
## Q107491.fctrYes 0.00000000 0.00000000
## Q107869.fctrYes 0.00000000 0.00000000
## Q108342.fctrIn-person 0.00000000 0.00000000
## Q108343.fctrNo 0.00000000 0.00000000
## Q108343.fctrYes 0.00000000 0.00000000
## Q108617.fctrNo 0.00000000 0.00000000
## Q108617.fctrYes 0.00000000 0.00000000
## Q108754.fctrNo 0.00000000 0.00000000
## Q108855.fctrUmm... 0.00000000 0.00000000
## Q108856.fctrSpace 0.00000000 0.00000000
## Q108950.fctrCautious 0.00000000 0.00000000
## Q108950.fctrRisk-friendly 0.00000000 0.00000000
## Q109367.fctrNo 0.00000000 0.00000000
## Q111580.fctrDemanding 0.00000000 0.00000000
## Q111580.fctrSupportive 0.00000000 0.00000000
## Q111848.fctrNo 0.00000000 0.00000000
## Q112270.fctrYes 0.00000000 0.00000000
## Q112478.fctrYes 0.00000000 0.00000000
## Q112512.fctrNo 0.00000000 0.00000000
## Q112512.fctrYes 0.00000000 0.00000000
## Q113583.fctrTalk 0.00000000 0.00000000
## Q113584.fctrPeople 0.00000000 0.00000000
## Q113584.fctrTechnology 0.00000000 0.00000000
## Q113992.fctrNo 0.00000000 0.00000000
## Q114152.fctrNo 0.00000000 0.00000000
## Q114152.fctrYes 0.00000000 0.00000000
## Q114386.fctrMysterious 0.00000000 0.00000000
## Q114386.fctrTMI 0.00000000 0.00000000
## Q114517.fctrYes 0.00000000 0.00000000
## Q114748.fctrNo 0.00000000 0.00000000
## Q114748.fctrYes 0.00000000 0.00000000
## Q114961.fctrNo 0.00000000 0.00000000
## Q114961.fctrYes 0.00000000 0.00000000
## Q115390.fctrNo 0.00000000 0.00000000
## Q115602.fctrNo 0.00000000 0.00000000
## Q115602.fctrYes 0.00000000 0.00000000
## Q115610.fctrYes 0.00000000 0.00000000
## Q115777.fctrEnd 0.00000000 0.00000000
## Q115777.fctrStart 0.00000000 0.00000000
## Q116197.fctrP.M. 0.00000000 0.00000000
## Q116441.fctrNo 0.00000000 0.00000000
## Q116441.fctrYes 0.00000000 0.00000000
## Q116448.fctrNo 0.00000000 0.00000000
## Q116448.fctrYes 0.00000000 0.00000000
## Q116601.fctrNo 0.00000000 0.00000000
## Q116601.fctrYes 0.00000000 0.00000000
## Q116797.fctrNo 0.00000000 0.00000000
## Q116797.fctrYes 0.00000000 0.00000000
## Q116953.fctrYes 0.00000000 0.00000000
## Q117186.fctrCool headed 0.00000000 0.00000000
## Q117186.fctrHot headed 0.00000000 0.00000000
## Q117193.fctrOdd hours 0.00000000 0.00000000
## Q117193.fctrStandard hours 0.00000000 0.00000000
## Q118117.fctrNo 0.00000000 0.00000000
## Q118232.fctrPr 0.00000000 0.00000000
## Q118233.fctrYes 0.00000000 0.00000000
## Q118237.fctrNo 0.00000000 0.00000000
## Q118237.fctrYes 0.00000000 0.00000000
## Q118892.fctrYes 0.00000000 0.00000000
## Q119334.fctrNo 0.00000000 0.00000000
## Q119334.fctrYes 0.00000000 0.00000000
## Q119650.fctrGiving 0.00000000 0.00000000
## Q119650.fctrReceiving 0.00000000 0.00000000
## Q120012.fctrNo 0.00000000 0.00000000
## Q120194.fctrTry first 0.00000000 0.00000000
## Q120472.fctrArt 0.00000000 0.00000000
## Q120650.fctrYes 0.00000000 0.00000000
## Q120978.fctrNo 0.00000000 0.00000000
## Q120978.fctrYes 0.00000000 0.00000000
## Q121699.fctrNo 0.00000000 0.00000000
## Q121700.fctrNo 0.00000000 0.00000000
## Q121700.fctrYes 0.00000000 0.00000000
## Q122120.fctrNo 0.00000000 0.00000000
## Q122769.fctrNo 0.00000000 0.00000000
## Q122769.fctrYes 0.00000000 0.00000000
## Q122770.fctrNo 0.00000000 0.00000000
## Q122770.fctrYes 0.00000000 0.00000000
## Q122771.fctrPc 0.00000000 0.00000000
## Q123464.fctrNo 0.00000000 0.00000000
## Q123464.fctrYes 0.00000000 0.00000000
## Q123621.fctrNo 0.00000000 0.00000000
## Q124122.fctrYes 0.00000000 0.00000000
## Q124742.fctrYes 0.00000000 0.00000000
## Q96024.fctrYes 0.00000000 0.00000000
## Q98078.fctrNo 0.00000000 0.00000000
## Q98078.fctrYes 0.00000000 0.00000000
## Q98578.fctrNo 0.00000000 0.00000000
## Q98578.fctrYes 0.00000000 0.00000000
## Q98869.fctrYes 0.00000000 0.00000000
## Q99581.fctrNo 0.00000000 0.00000000
## Q99581.fctrYes 0.00000000 0.00000000
## Q99716.fctrNo 0.00000000 0.00000000
## Q99982.fctrCheck! 0.00000000 0.00000000
## Q99982.fctrNope 0.00000000 0.00000000
## YOB.Age.fctr.C 0.00000000 0.00000000
## YOB.Age.fctr^4 0.00000000 0.00000000
## YOB.Age.fctr^5 0.00000000 0.00000000
## YOB.Age.fctr^6 0.00000000 0.00000000
## YOB.Age.fctr^7 0.00000000 0.00000000
## Q109244.fctrNA:.clusterid.fctr2 0.00000000 0.00000000
## Q109244.fctrNo:.clusterid.fctr2 0.00000000 0.00000000
## Q109244.fctrNA:.clusterid.fctr3 0.00000000 0.00000000
## YOB.Age.fctrNA:YOB.Age.dff 0.00000000 0.00000000
## YOB.Age.fctr(15,20]:YOB.Age.dff 0.00000000 0.00000000
## YOB.Age.fctr(20,25]:YOB.Age.dff 0.00000000 0.00000000
## YOB.Age.fctr(25,30]:YOB.Age.dff 0.00000000 0.00000000
## YOB.Age.fctr(50,65]:YOB.Age.dff 0.00000000 0.00000000
## YOB.Age.fctr(65,90]:YOB.Age.dff 0.00000000 0.00000000
#mdl_id <-"RFE.X.glmnet"; glb_featsimp_df <- myget_feats_importance(glb_models_lst[[mdl_id]], glb_featsimp_df); glb_featsimp_df[, paste0(mdl_id, ".imp")] <- glb_featsimp_df$imp; print(glb_featsimp_df)
#print(head(sbst_featsimp_df <- subset(glb_featsimp_df, is.na(RFE.X.glmnet.imp) | (abs(RFE.X.YeoJohnson.glmnet.imp - RFE.X.glmnet.imp) > 0.0001), select=-imp)))
#print(orderBy(~ -cor.y.abs, subset(glb_feats_df, id %in% c(row.names(sbst_featsimp_df), "startprice.dcm1.is9", "D.weight.post.stop.sum"))))
# Used again in fit.data.training & predict.data.new chunks
glb_analytics_diag_plots <- function(obs_df, mdl_id, prob_threshold=NULL) {
if (!is.null(featsimp_df <- glb_featsimp_df)) {
featsimp_df$feat <- gsub("`(.*?)`", "\\1", row.names(featsimp_df))
featsimp_df$feat.interact <- gsub("(.*?):(.*)", "\\2", featsimp_df$feat)
featsimp_df$feat <- gsub("(.*?):(.*)", "\\1", featsimp_df$feat)
featsimp_df$feat.interact <-
ifelse(featsimp_df$feat.interact == featsimp_df$feat,
NA, featsimp_df$feat.interact)
featsimp_df$feat <-
gsub("(.*?)\\.fctr(.*)", "\\1\\.fctr", featsimp_df$feat)
featsimp_df$feat.interact <-
gsub("(.*?)\\.fctr(.*)", "\\1\\.fctr", featsimp_df$feat.interact)
featsimp_df <- orderBy(~ -imp.max,
summaryBy(imp ~ feat + feat.interact, data=featsimp_df,
FUN=max))
#rex_str=":(.*)"; txt_vctr=tail(featsimp_df$feat); ret_lst <- regexec(rex_str, txt_vctr); ret_lst <- regmatches(txt_vctr, ret_lst); ret_vctr <- sapply(1:length(ret_lst), function(pos_ix) ifelse(length(ret_lst[[pos_ix]]) > 0, ret_lst[[pos_ix]], "")); print(ret_vctr <- ret_vctr[ret_vctr != ""])
featsimp_df <- subset(featsimp_df, !is.na(imp.max))
if (nrow(featsimp_df) > 5) {
warning("Limiting important feature scatter plots to 5 out of ",
nrow(featsimp_df))
featsimp_df <- head(featsimp_df, 5)
}
# if (!all(is.na(featsimp_df$feat.interact)))
# stop("not implemented yet")
rsp_var_out <- mygetPredictIds(glb_rsp_var, mdl_id)$value
for (var in featsimp_df$feat) {
plot_df <- melt(obs_df, id.vars = var,
measure.vars = c(glb_rsp_var, rsp_var_out))
print(myplot_scatter(plot_df, var, "value", colorcol_name = "variable",
facet_colcol_name = "variable", jitter = TRUE) +
guides(color = FALSE))
}
}
if (glb_is_regression) {
if (is.null(featsimp_df) || (nrow(featsimp_df) == 0))
warning("No important features in glb_fin_mdl") else
print(myplot_prediction_regression(df=obs_df,
feat_x=ifelse(nrow(featsimp_df) > 1, featsimp_df$feat[2],
".rownames"),
feat_y=featsimp_df$feat[1],
rsp_var=glb_rsp_var, rsp_var_out=rsp_var_out,
id_vars=glbFeatsId)
# + facet_wrap(reformulate(featsimp_df$feat[2])) # if [1 or 2] is a factor
# + geom_point(aes_string(color="<col_name>.fctr")) # to color the plot
)
}
if (glb_is_classification) {
require(lazyeval)
if (is.null(featsimp_df) || (nrow(featsimp_df) == 0))
warning("No features in selected model are statistically important")
else print(myplot_prediction_classification(df = obs_df,
feat_x = ifelse(nrow(featsimp_df) > 1,
featsimp_df$feat[2], ".rownames"),
feat_y = featsimp_df$feat[1],
rsp_var = glb_rsp_var,
rsp_var_out = rsp_var_out,
id_vars = glbFeatsId,
prob_threshold = prob_threshold))
}
}
if (glb_is_classification && glb_is_binomial)
glb_analytics_diag_plots(obs_df = glbObsOOB, mdl_id = glbMdlSelId,
prob_threshold = glb_models_df[glb_models_df$id == glbMdlSelId,
"opt.prob.threshold.OOB"]) else
glb_analytics_diag_plots(obs_df = glbObsOOB, mdl_id = glbMdlSelId)
## Warning in glb_analytics_diag_plots(obs_df = glbObsOOB, mdl_id =
## glbMdlSelId, : Limiting important feature scatter plots to 5 out of 109
## [1] "Min/Max Boundaries: "
## [1] "Inaccurate: "
## USER_ID Party.fctr Party.fctr.All.X..rcv.glmnet.prob
## 1 2641 D 0.1904087
## 2 1309 D 0.1929595
## 3 5511 R 0.2021862
## 4 1358 R 0.2050831
## 5 5457 R 0.2081525
## 6 2796 R 0.2089780
## Party.fctr.All.X..rcv.glmnet Party.fctr.All.X..rcv.glmnet.err
## 1 R TRUE
## 2 R TRUE
## 3 D TRUE
## 4 D TRUE
## 5 D TRUE
## 6 D TRUE
## Party.fctr.All.X..rcv.glmnet.err.abs Party.fctr.All.X..rcv.glmnet.is.acc
## 1 0.8095913 FALSE
## 2 0.8070405 FALSE
## 3 0.2021862 FALSE
## 4 0.2050831 FALSE
## 5 0.2081525 FALSE
## 6 0.2089780 FALSE
## Party.fctr.All.X..rcv.glmnet.accurate Party.fctr.All.X..rcv.glmnet.error
## 1 FALSE -0.009591335
## 2 FALSE -0.007040454
## 3 FALSE 0.002186191
## 4 FALSE 0.005083140
## 5 FALSE 0.008152545
## 6 FALSE 0.008978027
## USER_ID Party.fctr Party.fctr.All.X..rcv.glmnet.prob
## 118 3330 R 0.3920359
## 179 4177 R 0.4461766
## 246 2270 R 0.4948180
## 298 2570 R 0.5298507
## 491 1891 R 0.8232755
## 502 4606 R 0.8484120
## Party.fctr.All.X..rcv.glmnet Party.fctr.All.X..rcv.glmnet.err
## 118 D TRUE
## 179 D TRUE
## 246 D TRUE
## 298 D TRUE
## 491 D TRUE
## 502 D TRUE
## Party.fctr.All.X..rcv.glmnet.err.abs
## 118 0.3920359
## 179 0.4461766
## 246 0.4948180
## 298 0.5298507
## 491 0.8232755
## 502 0.8484120
## Party.fctr.All.X..rcv.glmnet.is.acc
## 118 FALSE
## 179 FALSE
## 246 FALSE
## 298 FALSE
## 491 FALSE
## 502 FALSE
## Party.fctr.All.X..rcv.glmnet.accurate
## 118 FALSE
## 179 FALSE
## 246 FALSE
## 298 FALSE
## 491 FALSE
## 502 FALSE
## Party.fctr.All.X..rcv.glmnet.error
## 118 0.1920359
## 179 0.2461766
## 246 0.2948180
## 298 0.3298507
## 491 0.6232755
## 502 0.6484120
## USER_ID Party.fctr Party.fctr.All.X..rcv.glmnet.prob
## 514 2590 R 0.8919417
## 515 4506 R 0.8921513
## 516 1307 R 0.8981039
## 517 626 R 0.9121686
## 518 468 R 0.9142371
## 519 3895 R 0.9229877
## Party.fctr.All.X..rcv.glmnet Party.fctr.All.X..rcv.glmnet.err
## 514 D TRUE
## 515 D TRUE
## 516 D TRUE
## 517 D TRUE
## 518 D TRUE
## 519 D TRUE
## Party.fctr.All.X..rcv.glmnet.err.abs
## 514 0.8919417
## 515 0.8921513
## 516 0.8981039
## 517 0.9121686
## 518 0.9142371
## 519 0.9229877
## Party.fctr.All.X..rcv.glmnet.is.acc
## 514 FALSE
## 515 FALSE
## 516 FALSE
## 517 FALSE
## 518 FALSE
## 519 FALSE
## Party.fctr.All.X..rcv.glmnet.accurate
## 514 FALSE
## 515 FALSE
## 516 FALSE
## 517 FALSE
## 518 FALSE
## 519 FALSE
## Party.fctr.All.X..rcv.glmnet.error
## 514 0.6919417
## 515 0.6921513
## 516 0.6981039
## 517 0.7121686
## 518 0.7142371
## 519 0.7229877
if (!is.null(glbFeatsCategory)) {
glbLvlCategory <- merge(glbLvlCategory,
myget_category_stats(obs_df = glbObsFit, mdl_id = glbMdlSelId,
label = "fit"),
by = glbFeatsCategory, all = TRUE)
row.names(glbLvlCategory) <- glbLvlCategory[, glbFeatsCategory]
glbLvlCategory <- merge(glbLvlCategory,
myget_category_stats(obs_df = glbObsOOB, mdl_id = glbMdlSelId,
label="OOB"),
#by=glbFeatsCategory, all=TRUE) glb_ctgry-df already contains .n.OOB ?
all = TRUE)
row.names(glbLvlCategory) <- glbLvlCategory[, glbFeatsCategory]
if (any(grepl("OOB", glbMdlMetricsEval)))
print(orderBy(~-err.abs.OOB.mean, glbLvlCategory)) else
print(orderBy(~-err.abs.fit.mean, glbLvlCategory))
print(colSums(glbLvlCategory[, -grep(glbFeatsCategory, names(glbLvlCategory))]))
}
## Q109244.fctr .n.OOB .n.Fit .n.Tst .freqRatio.Fit .freqRatio.OOB
## No No 498 1961 622 0.4403773 0.4466368
## NA NA 438 1746 547 0.3920952 0.3928251
## Yes Yes 179 746 223 0.1675275 0.1605381
## .freqRatio.Tst err.abs.fit.sum err.abs.fit.mean .n.fit err.abs.OOB.sum
## No 0.4468391 878.1282 0.4477961 1961 243.00394
## NA 0.3929598 827.6624 0.4740334 1746 211.30802
## Yes 0.1602011 195.3430 0.2618539 746 83.68265
## err.abs.OOB.mean
## No 0.4879597
## NA 0.4824384
## Yes 0.4675009
## .n.OOB .n.Fit .n.Tst .freqRatio.Fit
## 1115.000000 4453.000000 1392.000000 1.000000
## .freqRatio.OOB .freqRatio.Tst err.abs.fit.sum err.abs.fit.mean
## 1.000000 1.000000 1901.133610 1.183683
## .n.fit err.abs.OOB.sum err.abs.OOB.mean
## 4453.000000 537.994617 1.437899
write.csv(glbObsOOB[, c(glbFeatsId,
grep(glb_rsp_var, names(glbObsOOB), fixed=TRUE, value=TRUE))],
paste0(gsub(".", "_", paste0(glbOut$pfx, glbMdlSelId), fixed=TRUE),
"_OOBobs.csv"), row.names=FALSE)
fit.models_2_chunk_df <-
myadd_chunk(NULL, "fit.models_2_bgn", label.minor = "teardown")
## label step_major step_minor label_minor bgn end elapsed
## 1 fit.models_2_bgn 1 0 teardown 715.649 NA NA
glb_chunks_df <- myadd_chunk(glb_chunks_df, "fit.models", major.inc=FALSE)
## label step_major step_minor label_minor bgn end elapsed
## 18 fit.models 8 2 2 700.378 715.662 15.284
## 19 fit.models 8 3 3 715.663 NA NA
# if (sum(is.na(glbObsAll$D.P.http)) > 0)
# stop("fit.models_3: Why is this happening ?")
#stop(here"); glb2Sav()
sync_glb_obs_df <- function() {
# Merge or cbind ?
for (col in setdiff(names(glbObsFit), names(glbObsTrn)))
glbObsTrn[glbObsTrn$.lcn == "Fit", col] <<- glbObsFit[, col]
for (col in setdiff(names(glbObsFit), names(glbObsAll)))
glbObsAll[glbObsAll$.lcn == "Fit", col] <<- glbObsFit[, col]
if (all(is.na(glbObsNew[, glb_rsp_var])))
for (col in setdiff(names(glbObsOOB), names(glbObsTrn)))
glbObsTrn[glbObsTrn$.lcn == "OOB", col] <<- glbObsOOB[, col]
for (col in setdiff(names(glbObsOOB), names(glbObsAll)))
glbObsAll[glbObsAll$.lcn == "OOB", col] <<- glbObsOOB[, col]
}
sync_glb_obs_df()
print(setdiff(names(glbObsNew), names(glbObsAll)))
## character(0)
replay.petrisim(pn = glb_analytics_pn,
replay.trans = (glb_analytics_avl_objs <- c(glb_analytics_avl_objs,
"model.selected")), flip_coord = TRUE)
## time trans "bgn " "fit.data.training.all " "predict.data.new " "end "
## 0.0000 multiple enabled transitions: data.training.all data.new model.selected firing: data.training.all
## 1.0000 1 2 1 0 0
## 1.0000 multiple enabled transitions: data.training.all data.new model.selected model.final data.training.all.prediction firing: data.new
## 2.0000 2 1 1 1 0
## 2.0000 multiple enabled transitions: data.training.all data.new model.selected model.final data.training.all.prediction data.new.prediction firing: model.selected
## 3.0000 3 0 2 1 0
glb_chunks_df <- myadd_chunk(glb_chunks_df, "fit.data.training", major.inc = TRUE)
## label step_major step_minor label_minor bgn end
## 19 fit.models 8 3 3 715.663 720.504
## 20 fit.data.training 9 0 0 720.504 NA
## elapsed
## 19 4.841
## 20 NA
9.0: fit data training#load(paste0(glb_inp_pfx, "dsk.RData"))
if (!is.null(glbMdlFinId) && (glbMdlFinId %in% names(glb_models_lst))) {
warning("Final model same as user selected model")
glb_fin_mdl <- glb_models_lst[[glbMdlFinId]]
} else
# if (nrow(glbObsFit) + length(glbObsFitOutliers) == nrow(glbObsTrn))
if (!all(is.na(glbObsNew[, glb_rsp_var])))
{
warning("Final model same as glbMdlSelId")
glbMdlFinId <- paste0("Final.", glbMdlSelId)
glb_fin_mdl <- glb_sel_mdl
glb_models_lst[[glbMdlFinId]] <- glb_fin_mdl
mdlDf <- glb_models_df[glb_models_df$id == glbMdlSelId, ]
mdlDf$id <- glbMdlFinId
glb_models_df <- rbind(glb_models_df, mdlDf)
} else {
if (grepl("RFE\\.X", names(glbMdlFamilies))) {
indepVar <- mygetIndepVar(glb_feats_df)
rfe_trn_results <-
myrun_rfe(glbObsTrn, indepVar, glbRFESizes[["Final"]])
if (!isTRUE(all.equal(sort(predictors(rfe_trn_results)),
sort(predictors(rfe_fit_results))))) {
print("Diffs predictors(rfe_trn_results) vs. predictors(rfe_fit_results):")
print(setdiff(predictors(rfe_trn_results), predictors(rfe_fit_results)))
print("Diffs predictors(rfe_fit_results) vs. predictors(rfe_trn_results):")
print(setdiff(predictors(rfe_fit_results), predictors(rfe_trn_results)))
}
}
# }
if (grepl("Ensemble", glbMdlSelId)) {
# Find which models are relevant
mdlimp_df <- subset(myget_feats_importance(glb_sel_mdl), imp > 5)
# Fit selected models on glbObsTrn
for (mdl_id in gsub(".prob", "",
gsub(mygetPredictIds(glb_rsp_var)$value, "", row.names(mdlimp_df), fixed = TRUE),
fixed = TRUE)) {
mdl_id_components <- unlist(strsplit(mdl_id, "[.]"))
mdlIdPfx <- paste0(c(head(mdl_id_components, -1), "Train"),
collapse = ".")
if (grepl("RFE\\.X\\.", mdlIdPfx))
mdlIndepVars <- myadjustInteractionFeats(glb_feats_df, myextract_actual_feats(
predictors(rfe_trn_results))) else
mdlIndepVars <- trim(unlist(
strsplit(glb_models_df[glb_models_df$id == mdl_id, "feats"], "[,]")))
ret_lst <-
myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = mdlIdPfx,
type = glb_model_type, tune.df = glbMdlTuneParams,
trainControl.method = "repeatedcv",
trainControl.number = glb_rcv_n_folds,
trainControl.repeats = glb_rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize,
train.method = tail(mdl_id_components, 1))),
indepVar = mdlIndepVars,
rsp_var = glb_rsp_var,
fit_df = glbObsTrn, OOB_df = NULL)
glbObsTrn <- glb_get_predictions(df = glbObsTrn,
mdl_id = tail(glb_models_df$id, 1),
rsp_var = glb_rsp_var,
prob_threshold_def =
subset(glb_models_df, id == mdl_id)$opt.prob.threshold.OOB)
glbObsNew <- glb_get_predictions(df = glbObsNew,
mdl_id = tail(glb_models_df$id, 1),
rsp_var = glb_rsp_var,
prob_threshold_def =
subset(glb_models_df, id == mdl_id)$opt.prob.threshold.OOB)
}
}
# "Final" model
if ((model_method <- glb_sel_mdl$method) == "custom")
# get actual method from the mdl_id
model_method <- tail(unlist(strsplit(glbMdlSelId, "[.]")), 1)
if (grepl("Ensemble", glbMdlSelId)) {
# Find which models are relevant
mdlimp_df <- subset(myget_feats_importance(glb_sel_mdl), imp > 5)
if (glb_is_classification && glb_is_binomial)
indepVar <- gsub("(.*)\\.(.*)\\.prob", "\\1\\.Train\\.\\2\\.prob",
row.names(mdlimp_df)) else
indepVar <- gsub("(.*)\\.(.*)", "\\1\\.Train\\.\\2",
row.names(mdlimp_df))
} else
if (grepl("RFE.X", glbMdlSelId, fixed = TRUE)) {
indepVar <- myextract_actual_feats(predictors(rfe_trn_results))
} else indepVar <-
trim(unlist(strsplit(glb_models_df[glb_models_df$id ==
glbMdlSelId
, "feats"], "[,]")))
if (!is.null(glb_preproc_methods) &&
((match_pos <- regexpr(gsub(".", "\\.",
paste(glb_preproc_methods, collapse = "|"),
fixed = TRUE), glbMdlSelId)) != -1))
ths_preProcess <- str_sub(glbMdlSelId, match_pos,
match_pos + attr(match_pos, "match.length") - 1) else
ths_preProcess <- NULL
mdl_id_pfx <- ifelse(grepl("Ensemble", glbMdlSelId),
"Final.Ensemble", "Final")
trnobs_df <- glbObsTrn
if (!is.null(glbObsTrnOutliers[[mdl_id_pfx]])) {
trnobs_df <- glbObsTrn[!(glbObsTrn[, glbFeatsId] %in% glbObsTrnOutliers[[mdl_id_pfx]]), ]
print(sprintf("Outliers removed: %d", nrow(glbObsTrn) - nrow(trnobs_df)))
print(setdiff(glbObsTrn[, glbFeatsId], trnobs_df[, glbFeatsId]))
}
# Force fitting of Final.glm to identify outliers
method_vctr <- unique(c(myparseMdlId(glbMdlSelId)$alg, glbMdlFamilies[["Final"]]))
for (method in method_vctr) {
#source("caret_nominalTrainWorkflow.R")
# glmnet requires at least 2 indep vars
if ((length(indepVar) == 1) && (method %in% "glmnet"))
next
ret_lst <-
myfit_mdl(mdl_specs_lst = myinit_mdl_specs_lst(mdl_specs_lst = list(
id.prefix = mdl_id_pfx,
type = glb_model_type, trainControl.method = "repeatedcv",
trainControl.number = glb_rcv_n_folds,
trainControl.repeats = glb_rcv_n_repeats,
trainControl.classProbs = glb_is_classification,
trainControl.summaryFunction = glbMdlMetricSummaryFn,
trainControl.allowParallel = glbMdlAllowParallel,
train.metric = glbMdlMetricSummary,
train.maximize = glbMdlMetricMaximize,
train.method = method,
train.preProcess = ths_preProcess)),
indepVar = indepVar, rsp_var = glb_rsp_var,
fit_df = trnobs_df, OOB_df = NULL)
if ((length(method_vctr) == 1) || (method != "glm")) {
glb_fin_mdl <- glb_models_lst[[length(glb_models_lst)]]
glbMdlFinId <- glb_models_df[length(glb_models_lst), "id"]
}
}
}
## [1] "myfit_mdl: enter: 0.000000 secs"
## [1] "fitting model: Final##rcv#glmnet"
## [1] " indepVar: Q109244.fctr,Hhold.fctr,Edn.fctr,Q101163.fctr,Q100689.fctr,Q98078.fctr,Q99716.fctr,Q120379.fctr,Q121699.fctr,Q105840.fctr,Q113583.fctr,Q115195.fctr,Q102089.fctr,Q98059.fctr,Q114386.fctr,Q100680.fctr,Q108342.fctr,Q111848.fctr,YOB.Age.fctr,Q118892.fctr,Q102687.fctr,Q115390.fctr,Q119851.fctr,Q114517.fctr,Q120012.fctr,Q109367.fctr,Q114961.fctr,Q121700.fctr,Q124122.fctr,Q111220.fctr,Q113992.fctr,Q121011.fctr,Q106042.fctr,Q116448.fctr,Q116601.fctr,Q104996.fctr,Q102906.fctr,Q113584.fctr,Q108950.fctr,Q102674.fctr,Q103293.fctr,Q112478.fctr,Q114748.fctr,Q107491.fctr,Q100562.fctr,Q108617.fctr,Q100010.fctr,Q115602.fctr,Q116953.fctr,Q115610.fctr,Q106997.fctr,Q120978.fctr,Q112512.fctr,Q108343.fctr,Q96024.fctr,Q106389.fctr,.rnorm,Q108754.fctr,Q98578.fctr,Q101162.fctr,Q115777.fctr,Q99581.fctr,Q124742.fctr,Q116797.fctr,Q112270.fctr,Q118237.fctr,Q119650.fctr,Q111580.fctr,Q123464.fctr,Q117193.fctr,Q99982.fctr,Q108856.fctr,Q118233.fctr,Q102289.fctr,Q116197.fctr,Income.fctr,Q118232.fctr,Q120194.fctr,Q114152.fctr,Q122770.fctr,Q117186.fctr,Q105655.fctr,Q106993.fctr,Q119334.fctr,Q122120.fctr,Q116441.fctr,Q118117.fctr,Q123621.fctr,Q122769.fctr,Q120650.fctr,Q98869.fctr,Q107869.fctr,Q120014.fctr,Q115899.fctr,Q106388.fctr,Q99480.fctr,Q122771.fctr,Q108855.fctr,Q110740.fctr,Q106272.fctr,Q101596.fctr,Q116881.fctr,Q120472.fctr,Q98197.fctr,Q113181.fctr,Q115611.fctr,Gender.fctr,Q109244.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff"
## [1] "myfit_mdl: setup complete: 0.711000 secs"
## Aggregating results
## Selecting tuning parameters
## Fitting alpha = 0.775, lambda = 0.0113 on full training set
## [1] "myfit_mdl: train complete: 30.311000 secs"
## Length Class Mode
## a0 77 -none- numeric
## beta 19019 dgCMatrix S4
## df 77 -none- numeric
## dim 2 -none- numeric
## lambda 77 -none- numeric
## dev.ratio 77 -none- numeric
## nulldev 1 -none- numeric
## npasses 1 -none- numeric
## jerr 1 -none- numeric
## offset 1 -none- logical
## classnames 2 -none- character
## call 5 -none- call
## nobs 1 -none- numeric
## lambdaOpt 1 -none- numeric
## xNames 247 -none- character
## problemType 1 -none- character
## tuneValue 2 data.frame list
## obsLevels 2 -none- character
## [1] "min lambda > lambdaOpt:"
## (Intercept) Edn.fctr.L
## 0.2137450170 0.0137298532
## Gender.fctrM Hhold.fctrMKy
## -0.1118018113 -0.0915613859
## Hhold.fctrPKn Income.fctr.Q
## 0.3784350463 -0.0526235541
## Income.fctr.C Q100689.fctrYes
## -0.0650320100 0.0736391312
## Q101163.fctrDad Q101163.fctrMom
## -0.0897328022 0.0563376077
## Q104996.fctrNo Q106042.fctrNo
## -0.0256684069 -0.0276582966
## Q106389.fctrNo Q106997.fctrGr
## -0.0218183330 -0.0741399988
## Q108855.fctrYes! Q109244.fctrNo
## -0.0264495567 -0.3451969230
## Q109244.fctrYes Q110740.fctrMac
## 0.8392352985 0.0257825650
## Q110740.fctrPC Q112478.fctrNo
## -0.0706111255 -0.0365651586
## Q113181.fctrNo Q113181.fctrYes
## 0.1151975866 -0.1720440647
## Q115195.fctrYes Q115390.fctrNo
## 0.0158094478 -0.0068169219
## Q115390.fctrYes Q115611.fctrNo
## 0.0528295854 0.1233487967
## Q115611.fctrYes Q115899.fctrCs
## -0.3335465226 0.0511448388
## Q116881.fctrHappy Q116881.fctrRight
## 0.0144787609 -0.1668155686
## Q116953.fctrNo Q118232.fctrId
## -0.0310715279 0.0950495921
## Q118233.fctrNo Q119851.fctrNo
## -0.0004790798 -0.1026921947
## Q120194.fctrStudy first Q120379.fctrNo
## 0.0404780724 -0.0101991233
## Q120379.fctrYes Q120472.fctrScience
## 0.0870614251 -0.0842473016
## Q120650.fctrYes Q121699.fctrYes
## -0.0006584151 0.0293070511
## Q122120.fctrYes Q122771.fctrPt
## -0.0132816557 -0.0802288638
## Q124742.fctrNo Q98197.fctrNo
## 0.0055662028 0.2866154026
## Q98197.fctrYes Q98869.fctrNo
## -0.0193407743 0.1879800673
## Q99480.fctrNo Q99480.fctrYes
## 0.0342632866 -0.0493911301
## YOB.Age.fctr.L Q109244.fctrYes:.clusterid.fctr3
## 0.0548137521 0.4652264175
## YOB.Age.fctr(35,40]:YOB.Age.dff
## 0.0442244695
## [1] "max lambda < lambdaOpt:"
## (Intercept) Edn.fctr.L
## 0.2203118611 0.0164878503
## Gender.fctrM Hhold.fctrMKy
## -0.1140742015 -0.1034070965
## Hhold.fctrPKn Income.fctr.Q
## 0.3892296801 -0.0597496040
## Income.fctr.C Q100689.fctrYes
## -0.0778545533 0.0825903353
## Q101163.fctrDad Q101163.fctrMom
## -0.0919306457 0.0620417500
## Q104996.fctrNo Q106042.fctrNo
## -0.0340483923 -0.0303955769
## Q106389.fctrNo Q106997.fctrGr
## -0.0304847559 -0.0833257766
## Q108855.fctrYes! Q109244.fctrNo
## -0.0338482572 -0.3460957774
## Q109244.fctrYes Q110740.fctrMac
## 0.8383683060 0.0335273621
## Q110740.fctrPC Q111220.fctrYes
## -0.0720542063 0.0024957223
## Q112270.fctrNo Q112478.fctrNo
## 0.0004360146 -0.0444971224
## Q113181.fctrNo Q113181.fctrYes
## 0.1195422670 -0.1736312019
## Q113583.fctrTunes Q115195.fctrYes
## 0.0030507655 0.0238639799
## Q115390.fctrNo Q115390.fctrYes
## -0.0163728293 0.0546541871
## Q115611.fctrNo Q115611.fctrYes
## 0.1235163740 -0.3391519759
## Q115899.fctrCs Q116881.fctrHappy
## 0.0595275431 0.0237945727
## Q116881.fctrRight Q116953.fctrNo
## -0.1674378539 -0.0415880568
## Q118232.fctrId Q118233.fctrNo
## 0.1056052655 -0.0108836370
## Q119851.fctrNo Q120194.fctrStudy first
## -0.1095908511 0.0502108640
## Q120379.fctrNo Q120379.fctrYes
## -0.0080943922 0.0998188178
## Q120472.fctrScience Q120650.fctrYes
## -0.0911562463 -0.0119719594
## Q121699.fctrYes Q122120.fctrYes
## 0.0381408439 -0.0228220391
## Q122771.fctrPt Q124742.fctrNo
## -0.0914227249 0.0183229077
## Q98197.fctrNo Q98197.fctrYes
## 0.2954726779 -0.0169509648
## Q98869.fctrNo Q99480.fctrNo
## 0.1973799027 0.0349090041
## Q99480.fctrYes YOB.Age.fctr.L
## -0.0602809159 0.0688552257
## Q109244.fctrYes:.clusterid.fctr3 YOB.Age.fctr(35,40]:YOB.Age.dff
## 0.4959597027 0.0478237942
## [1] "myfit_mdl: train diagnostics complete: 31.040000 secs"
## Prediction
## Reference R D
## R 748 1869
## D 287 2664
## Accuracy Kappa AccuracyLower AccuracyUpper AccuracyNull
## 6.127874e-01 1.952477e-01 5.998465e-01 6.256099e-01 5.299928e-01
## AccuracyPValue McnemarPValue
## 8.429278e-36 4.164504e-254
## [1] "myfit_mdl: predict complete: 38.402000 secs"
## id
## 1 Final##rcv#glmnet
## feats
## 1 Q109244.fctr,Hhold.fctr,Edn.fctr,Q101163.fctr,Q100689.fctr,Q98078.fctr,Q99716.fctr,Q120379.fctr,Q121699.fctr,Q105840.fctr,Q113583.fctr,Q115195.fctr,Q102089.fctr,Q98059.fctr,Q114386.fctr,Q100680.fctr,Q108342.fctr,Q111848.fctr,YOB.Age.fctr,Q118892.fctr,Q102687.fctr,Q115390.fctr,Q119851.fctr,Q114517.fctr,Q120012.fctr,Q109367.fctr,Q114961.fctr,Q121700.fctr,Q124122.fctr,Q111220.fctr,Q113992.fctr,Q121011.fctr,Q106042.fctr,Q116448.fctr,Q116601.fctr,Q104996.fctr,Q102906.fctr,Q113584.fctr,Q108950.fctr,Q102674.fctr,Q103293.fctr,Q112478.fctr,Q114748.fctr,Q107491.fctr,Q100562.fctr,Q108617.fctr,Q100010.fctr,Q115602.fctr,Q116953.fctr,Q115610.fctr,Q106997.fctr,Q120978.fctr,Q112512.fctr,Q108343.fctr,Q96024.fctr,Q106389.fctr,.rnorm,Q108754.fctr,Q98578.fctr,Q101162.fctr,Q115777.fctr,Q99581.fctr,Q124742.fctr,Q116797.fctr,Q112270.fctr,Q118237.fctr,Q119650.fctr,Q111580.fctr,Q123464.fctr,Q117193.fctr,Q99982.fctr,Q108856.fctr,Q118233.fctr,Q102289.fctr,Q116197.fctr,Income.fctr,Q118232.fctr,Q120194.fctr,Q114152.fctr,Q122770.fctr,Q117186.fctr,Q105655.fctr,Q106993.fctr,Q119334.fctr,Q122120.fctr,Q116441.fctr,Q118117.fctr,Q123621.fctr,Q122769.fctr,Q120650.fctr,Q98869.fctr,Q107869.fctr,Q120014.fctr,Q115899.fctr,Q106388.fctr,Q99480.fctr,Q122771.fctr,Q108855.fctr,Q110740.fctr,Q106272.fctr,Q101596.fctr,Q116881.fctr,Q120472.fctr,Q98197.fctr,Q113181.fctr,Q115611.fctr,Gender.fctr,Q109244.fctr:.clusterid.fctr,YOB.Age.fctr:YOB.Age.dff
## max.nTuningRuns min.elapsedtime.everything min.elapsedtime.final
## 1 25 29.445 2.356
## max.AUCpROC.fit max.Sens.fit max.Spec.fit max.AUCROCR.fit
## 1 0.6437944 0.5708827 0.7167062 0.2923222
## opt.prob.threshold.fit max.f.score.fit max.Accuracy.fit
## 1 0.4 0.7119188 0.6343376
## max.AccuracyLower.fit max.AccuracyUpper.fit max.Kappa.fit
## 1 0.5998465 0.6256099 0.2620574
## max.AccuracySD.fit max.KappaSD.fit
## 1 0.01204578 0.02430734
## [1] "myfit_mdl: exit: 38.418000 secs"
rm(ret_lst)
glb_chunks_df <- myadd_chunk(glb_chunks_df, "fit.data.training", major.inc=FALSE)
## label step_major step_minor label_minor bgn end
## 20 fit.data.training 9 0 0 720.504 759.533
## 21 fit.data.training 9 1 1 759.534 NA
## elapsed
## 20 39.029
## 21 NA
#stop(here"); glb2Sav()
if (glb_is_classification && glb_is_binomial)
prob_threshold <- glb_models_df[glb_models_df$id == glbMdlSelId,
"opt.prob.threshold.OOB"] else
prob_threshold <- NULL
if (grepl("Ensemble", glbMdlFinId)) {
# Get predictions for each model in ensemble; Outliers that have been moved to OOB might not have been predicted yet
mdlEnsembleComps <- unlist(str_split(subset(glb_models_df,
id == glbMdlFinId)$feats, ","))
if (glb_is_classification && glb_is_binomial)
mdlEnsembleComps <- gsub("\\.prob$", "", mdlEnsembleComps)
mdlEnsembleComps <- gsub(paste0("^",
gsub(".", "\\.", mygetPredictIds(glb_rsp_var)$value, fixed = TRUE)),
"", mdlEnsembleComps)
for (mdl_id in mdlEnsembleComps) {
glbObsTrn <- glb_get_predictions(df = glbObsTrn, mdl_id = mdl_id,
rsp_var = glb_rsp_var,
prob_threshold_def = prob_threshold)
glbObsNew <- glb_get_predictions(df = glbObsNew, mdl_id = mdl_id,
rsp_var = glb_rsp_var,
prob_threshold_def = prob_threshold)
}
}
glbObsTrn <- glb_get_predictions(df = glbObsTrn, mdl_id = glbMdlFinId,
rsp_var = glb_rsp_var,
prob_threshold_def = prob_threshold)
## Warning in glb_get_predictions(df = glbObsTrn, mdl_id = glbMdlFinId,
## rsp_var = glb_rsp_var, : Using default probability threshold: 0.2
glb_featsimp_df <- myget_feats_importance(mdl=glb_fin_mdl,
featsimp_df=glb_featsimp_df)
#glb_featsimp_df[, paste0(glbMdlFinId, ".imp")] <- glb_featsimp_df$imp
print(glb_featsimp_df)
## All.X..rcv.glmnet.imp
## Q109244.fctrYes 100.00000000
## Q109244.fctrYes:.clusterid.fctr3 74.83524172
## Hhold.fctrPKn 56.07166248
## Q109244.fctrNo 48.62666730
## Q115611.fctrYes 32.55451130
## Q98197.fctrNo 19.08037962
## Q98869.fctrNo 29.59870981
## Q113181.fctrYes 19.94584594
## Q116881.fctrRight 18.35159601
## Q115611.fctrNo 13.55836897
## Q113181.fctrNo 13.82056528
## Gender.fctrM 11.26226797
## Q119851.fctrNo 8.82177415
## Q118232.fctrId 11.71606377
## Hhold.fctrMKy 10.88887536
## Q120379.fctrYes 8.72763956
## Q101163.fctrDad 13.75204636
## Q120472.fctrScience 9.30387759
## Q122771.fctrPt 11.72223583
## Q106997.fctrGr 5.26924807
## Q100689.fctrYes 11.07215345
## Q110740.fctrPC 9.74445742
## Income.fctr.C 7.94668154
## YOB.Age.fctr.L 11.67898928
## Q101163.fctrMom 7.99148480
## Income.fctr.Q 13.86599639
## Q115899.fctrCs 8.58052411
## Q115390.fctrYes 5.46271052
## Q99480.fctrYes 6.55188429
## YOB.Age.fctr(35,40]:YOB.Age.dff 8.46295014
## Q120194.fctrStudy first 0.44603169
## Q112478.fctrNo 3.70260744
## Q99480.fctrNo 14.26145355
## Q116953.fctrNo 7.52386562
## Q121699.fctrYes 6.92634843
## Q108855.fctrYes! 3.15385609
## Q106042.fctrNo 8.02282573
## Q104996.fctrNo 4.76145512
## Q110740.fctrMac 0.14688590
## Q106389.fctrNo 4.45417061
## Q98197.fctrYes 14.10050710
## Q115195.fctrYes 3.34637604
## Q116881.fctrHappy 2.02590119
## Q122120.fctrYes 8.74819725
## Edn.fctr.L 9.58710195
## Q115390.fctrNo 0.00000000
## Q120379.fctrNo 2.92388939
## Q124742.fctrNo 4.32155212
## Q120650.fctrYes 0.00000000
## Q118233.fctrNo 6.08758392
## Q113583.fctrTunes 2.54885123
## Q111220.fctrYes 6.71245413
## Q112270.fctrNo 0.38893593
## .rnorm 0.67045796
## Edn.fctr.C 0.00000000
## Edn.fctr.Q 0.00000000
## Edn.fctr^4 0.06157361
## Edn.fctr^5 0.00000000
## Edn.fctr^6 1.03595109
## Edn.fctr^7 1.78571813
## Gender.fctrF 1.48659080
## Hhold.fctrMKn 0.00000000
## Hhold.fctrPKy 0.00000000
## Hhold.fctrSKn 0.00000000
## Hhold.fctrSKy 10.85076994
## Income.fctr.L 0.00000000
## Income.fctr^4 0.00000000
## Income.fctr^5 0.00000000
## Income.fctr^6 0.00000000
## Q100010.fctrNo 0.00000000
## Q100010.fctrYes 0.00000000
## Q100562.fctrNo 0.00000000
## Q100562.fctrYes 0.00000000
## Q100680.fctrNo 0.00000000
## Q100680.fctrYes 0.00000000
## Q100689.fctrNo 0.00000000
## Q101162.fctrOptimist 0.00000000
## Q101162.fctrPessimist 0.19555307
## Q101596.fctrNo 0.00000000
## Q101596.fctrYes 2.11049389
## Q102089.fctrOwn 0.00000000
## Q102089.fctrRent 4.80424869
## Q102289.fctrNo 0.00000000
## Q102289.fctrYes 0.00000000
## Q102674.fctrNo 0.00000000
## Q102674.fctrYes 0.00000000
## Q102687.fctrNo 0.00000000
## Q102687.fctrYes 3.28607116
## Q102906.fctrNo 0.00000000
## Q102906.fctrYes 0.49089280
## Q103293.fctrNo 0.00000000
## Q103293.fctrYes 0.00000000
## Q104996.fctrYes 1.36763194
## Q105655.fctrNo 0.00000000
## Q105655.fctrYes 1.65652793
## Q105840.fctrNo 1.03353293
## Q105840.fctrYes 4.05671656
## Q106042.fctrYes 0.00000000
## Q106272.fctrNo 0.00000000
## Q106272.fctrYes 0.00000000
## Q106388.fctrNo 0.00000000
## Q106388.fctrYes 2.84659573
## Q106389.fctrYes 0.00000000
## Q106993.fctrNo 0.00000000
## Q106993.fctrYes 0.00000000
## Q106997.fctrYy 0.00000000
## Q107491.fctrNo 0.00000000
## Q107491.fctrYes 0.00000000
## Q107869.fctrNo 1.26871030
## Q107869.fctrYes 0.00000000
## Q108342.fctrIn-person 0.00000000
## Q108342.fctrOnline 6.01216739
## Q108343.fctrNo 0.00000000
## Q108343.fctrYes 0.00000000
## Q108617.fctrNo 0.00000000
## Q108617.fctrYes 0.00000000
## Q108754.fctrNo 0.00000000
## Q108754.fctrYes 4.34557066
## Q108855.fctrUmm... 0.00000000
## Q108856.fctrSocialize 4.00115748
## Q108856.fctrSpace 0.00000000
## Q108950.fctrCautious 0.00000000
## Q108950.fctrRisk-friendly 0.00000000
## Q109244.fctrNA:.clusterid.fctr2 0.00000000
## Q109244.fctrNA:.clusterid.fctr3 0.00000000
## Q109244.fctrNo:.clusterid.fctr2 0.00000000
## Q109244.fctrNo:.clusterid.fctr3 2.98506027
## Q109244.fctrYes:.clusterid.fctr2 16.58519910
## Q109367.fctrNo 0.00000000
## Q109367.fctrYes 1.04513935
## Q111220.fctrNo 0.65585161
## Q111580.fctrDemanding 0.00000000
## Q111580.fctrSupportive 0.00000000
## Q111848.fctrNo 0.00000000
## Q111848.fctrYes 5.39877518
## Q112270.fctrYes 0.00000000
## Q112478.fctrYes 0.00000000
## Q112512.fctrNo 0.00000000
## Q112512.fctrYes 0.00000000
## Q113583.fctrTalk 0.00000000
## Q113584.fctrPeople 0.00000000
## Q113584.fctrTechnology 0.00000000
## Q113992.fctrNo 0.00000000
## Q113992.fctrYes 0.90946080
## Q114152.fctrNo 0.00000000
## Q114152.fctrYes 0.00000000
## Q114386.fctrMysterious 0.00000000
## Q114386.fctrTMI 0.00000000
## Q114517.fctrNo 3.98135122
## Q114517.fctrYes 0.00000000
## Q114748.fctrNo 0.00000000
## Q114748.fctrYes 0.00000000
## Q114961.fctrNo 0.00000000
## Q114961.fctrYes 0.00000000
## Q115195.fctrNo 1.24440039
## Q115602.fctrNo 0.00000000
## Q115602.fctrYes 0.00000000
## Q115610.fctrNo 2.84336116
## Q115610.fctrYes 0.00000000
## Q115777.fctrEnd 0.00000000
## Q115777.fctrStart 0.00000000
## Q115899.fctrMe 3.47312792
## Q116197.fctrA.M. 1.87585384
## Q116197.fctrP.M. 0.00000000
## Q116441.fctrNo 0.00000000
## Q116441.fctrYes 0.00000000
## Q116448.fctrNo 0.00000000
## Q116448.fctrYes 0.00000000
## Q116601.fctrNo 0.00000000
## Q116601.fctrYes 0.00000000
## Q116797.fctrNo 0.00000000
## Q116797.fctrYes 0.00000000
## Q116953.fctrYes 0.00000000
## Q117186.fctrCool headed 0.00000000
## Q117186.fctrHot headed 0.00000000
## Q117193.fctrOdd hours 0.00000000
## Q117193.fctrStandard hours 0.00000000
## Q118117.fctrNo 0.00000000
## Q118117.fctrYes 4.29851252
## Q118232.fctrPr 0.00000000
## Q118233.fctrYes 0.00000000
## Q118237.fctrNo 0.00000000
## Q118237.fctrYes 0.00000000
## Q118892.fctrNo 1.28850407
## Q118892.fctrYes 0.00000000
## Q119334.fctrNo 0.00000000
## Q119334.fctrYes 0.00000000
## Q119650.fctrGiving 0.00000000
## Q119650.fctrReceiving 0.00000000
## Q119851.fctrYes 10.55044508
## Q120012.fctrNo 0.00000000
## Q120012.fctrYes 3.45790000
## Q120014.fctrNo 1.45702356
## Q120014.fctrYes 1.03153405
## Q120194.fctrTry first 0.00000000
## Q120472.fctrArt 0.00000000
## Q120650.fctrNo 2.21427505
## Q120978.fctrNo 0.00000000
## Q120978.fctrYes 0.00000000
## Q121011.fctrNo 0.05663566
## Q121011.fctrYes 0.06720879
## Q121699.fctrNo 0.00000000
## Q121700.fctrNo 0.00000000
## Q121700.fctrYes 0.00000000
## Q122120.fctrNo 0.00000000
## Q122769.fctrNo 0.00000000
## Q122769.fctrYes 0.00000000
## Q122770.fctrNo 0.00000000
## Q122770.fctrYes 0.00000000
## Q122771.fctrPc 0.00000000
## Q123464.fctrNo 0.00000000
## Q123464.fctrYes 0.00000000
## Q123621.fctrNo 0.00000000
## Q123621.fctrYes 0.69156664
## Q124122.fctrNo 1.46466576
## Q124122.fctrYes 0.00000000
## Q124742.fctrYes 0.00000000
## Q96024.fctrNo 0.39291769
## Q96024.fctrYes 0.00000000
## Q98059.fctrOnly-child 5.51640543
## Q98059.fctrYes 4.92287648
## Q98078.fctrNo 0.00000000
## Q98078.fctrYes 0.00000000
## Q98578.fctrNo 0.00000000
## Q98578.fctrYes 0.00000000
## Q98869.fctrYes 0.00000000
## Q99581.fctrNo 0.00000000
## Q99581.fctrYes 0.00000000
## Q99716.fctrNo 0.00000000
## Q99716.fctrYes 5.67108541
## Q99982.fctrCheck! 0.00000000
## Q99982.fctrNope 0.00000000
## YOB.Age.fctr(15,20]:YOB.Age.dff 0.00000000
## YOB.Age.fctr(20,25]:YOB.Age.dff 0.00000000
## YOB.Age.fctr(25,30]:YOB.Age.dff 0.00000000
## YOB.Age.fctr(30,35]:YOB.Age.dff 0.85039014
## YOB.Age.fctr(40,50]:YOB.Age.dff 0.16989470
## YOB.Age.fctr(50,65]:YOB.Age.dff 0.00000000
## YOB.Age.fctr(65,90]:YOB.Age.dff 0.00000000
## YOB.Age.fctr.C 0.00000000
## YOB.Age.fctr.Q 0.51193745
## YOB.Age.fctrNA:YOB.Age.dff 0.00000000
## YOB.Age.fctr^4 0.00000000
## YOB.Age.fctr^5 0.00000000
## YOB.Age.fctr^6 0.00000000
## YOB.Age.fctr^7 0.00000000
## YOB.Age.fctr^8 3.86788345
## Final..rcv.glmnet.imp imp
## Q109244.fctrYes 100.00000000 100.00000000
## Q109244.fctrYes:.clusterid.fctr3 56.54667024 56.54667024
## Hhold.fctrPKn 45.49136867 45.49136867
## Q109244.fctrNo 41.17704754 41.17704754
## Q115611.fctrYes 39.95609207 39.95609207
## Q98197.fctrNo 34.47809360 34.47809360
## Q98869.fctrNo 22.74079252 22.74079252
## Q113181.fctrYes 20.56297862 20.56297862
## Q116881.fctrRight 19.90540268 19.90540268
## Q115611.fctrNo 14.70827144 14.70827144
## Q113181.fctrNo 13.88552941 13.88552941
## Gender.fctrM 13.40694430 13.40694430
## Q119851.fctrNo 12.48597007 12.48597007
## Q118232.fctrId 11.70532049 11.70532049
## Hhold.fctrMKy 11.33551330 11.33551330
## Q120379.fctrYes 10.83163188 10.83163188
## Q101163.fctrDad 10.77381908 10.77381908
## Q120472.fctrScience 10.28783631 10.28783631
## Q122771.fctrPt 9.96153263 9.96153263
## Q106997.fctrGr 9.16423795 9.16423795
## Q100689.fctrYes 9.09618055 9.09618055
## Q110740.fctrPC 8.46775983 8.46775983
## Income.fctr.C 8.20820321 8.20820321
## YOB.Age.fctr.L 7.03368820 7.03368820
## Q101163.fctrMom 6.91827351 6.91827351
## Income.fctr.Q 6.52624527 6.52624527
## Q115899.fctrCs 6.39476574 6.39476574
## Q115390.fctrYes 6.36191954 6.36191954
## Q99480.fctrYes 6.27505992 6.27505992
## YOB.Age.fctr(35,40]:YOB.Age.dff 5.39948172 5.39948172
## Q120194.fctrStudy first 5.17146463 5.17146463
## Q112478.fctrNo 4.64091211 4.64091211
## Q99480.fctrNo 4.10694653 4.10694653
## Q116953.fctrNo 4.07819477 4.07819477
## Q121699.fctrYes 3.80792813 3.80792813
## Q108855.fctrYes! 3.41620474 3.41620474
## Q106042.fctrNo 3.39419807 3.39419807
## Q104996.fctrNo 3.35805904 3.35805904
## Q110740.fctrMac 3.34903501 3.34903501
## Q106389.fctrNo 2.90936294 2.90936294
## Q98197.fctrYes 2.22013742 2.22013742
## Q115195.fctrYes 2.17134566 2.17134566
## Q116881.fctrHappy 2.05767486 2.05767486
## Q122120.fctrYes 1.92298959 1.92298959
## Edn.fctr.L 1.73476461 1.73476461
## Q115390.fctrNo 1.15299231 1.15299231
## Q120379.fctrNo 1.14067446 1.14067446
## Q124742.fctrNo 1.11795542 1.11795542
## Q120650.fctrYes 0.48156417 0.48156417
## Q118233.fctrNo 0.42780274 0.42780274
## Q113583.fctrTunes 0.10869451 0.10869451
## Q111220.fctrYes 0.08891910 0.08891910
## Q112270.fctrNo 0.01553459 0.01553459
## .rnorm 0.00000000 0.00000000
## Edn.fctr.C 0.00000000 0.00000000
## Edn.fctr.Q 0.00000000 0.00000000
## Edn.fctr^4 0.00000000 0.00000000
## Edn.fctr^5 0.00000000 0.00000000
## Edn.fctr^6 0.00000000 0.00000000
## Edn.fctr^7 0.00000000 0.00000000
## Gender.fctrF 0.00000000 0.00000000
## Hhold.fctrMKn 0.00000000 0.00000000
## Hhold.fctrPKy 0.00000000 0.00000000
## Hhold.fctrSKn 0.00000000 0.00000000
## Hhold.fctrSKy 0.00000000 0.00000000
## Income.fctr.L 0.00000000 0.00000000
## Income.fctr^4 0.00000000 0.00000000
## Income.fctr^5 0.00000000 0.00000000
## Income.fctr^6 0.00000000 0.00000000
## Q100010.fctrNo 0.00000000 0.00000000
## Q100010.fctrYes 0.00000000 0.00000000
## Q100562.fctrNo 0.00000000 0.00000000
## Q100562.fctrYes 0.00000000 0.00000000
## Q100680.fctrNo 0.00000000 0.00000000
## Q100680.fctrYes 0.00000000 0.00000000
## Q100689.fctrNo 0.00000000 0.00000000
## Q101162.fctrOptimist 0.00000000 0.00000000
## Q101162.fctrPessimist 0.00000000 0.00000000
## Q101596.fctrNo 0.00000000 0.00000000
## Q101596.fctrYes 0.00000000 0.00000000
## Q102089.fctrOwn 0.00000000 0.00000000
## Q102089.fctrRent 0.00000000 0.00000000
## Q102289.fctrNo 0.00000000 0.00000000
## Q102289.fctrYes 0.00000000 0.00000000
## Q102674.fctrNo 0.00000000 0.00000000
## Q102674.fctrYes 0.00000000 0.00000000
## Q102687.fctrNo 0.00000000 0.00000000
## Q102687.fctrYes 0.00000000 0.00000000
## Q102906.fctrNo 0.00000000 0.00000000
## Q102906.fctrYes 0.00000000 0.00000000
## Q103293.fctrNo 0.00000000 0.00000000
## Q103293.fctrYes 0.00000000 0.00000000
## Q104996.fctrYes 0.00000000 0.00000000
## Q105655.fctrNo 0.00000000 0.00000000
## Q105655.fctrYes 0.00000000 0.00000000
## Q105840.fctrNo 0.00000000 0.00000000
## Q105840.fctrYes 0.00000000 0.00000000
## Q106042.fctrYes 0.00000000 0.00000000
## Q106272.fctrNo 0.00000000 0.00000000
## Q106272.fctrYes 0.00000000 0.00000000
## Q106388.fctrNo 0.00000000 0.00000000
## Q106388.fctrYes 0.00000000 0.00000000
## Q106389.fctrYes 0.00000000 0.00000000
## Q106993.fctrNo 0.00000000 0.00000000
## Q106993.fctrYes 0.00000000 0.00000000
## Q106997.fctrYy 0.00000000 0.00000000
## Q107491.fctrNo 0.00000000 0.00000000
## Q107491.fctrYes 0.00000000 0.00000000
## Q107869.fctrNo 0.00000000 0.00000000
## Q107869.fctrYes 0.00000000 0.00000000
## Q108342.fctrIn-person 0.00000000 0.00000000
## Q108342.fctrOnline 0.00000000 0.00000000
## Q108343.fctrNo 0.00000000 0.00000000
## Q108343.fctrYes 0.00000000 0.00000000
## Q108617.fctrNo 0.00000000 0.00000000
## Q108617.fctrYes 0.00000000 0.00000000
## Q108754.fctrNo 0.00000000 0.00000000
## Q108754.fctrYes 0.00000000 0.00000000
## Q108855.fctrUmm... 0.00000000 0.00000000
## Q108856.fctrSocialize 0.00000000 0.00000000
## Q108856.fctrSpace 0.00000000 0.00000000
## Q108950.fctrCautious 0.00000000 0.00000000
## Q108950.fctrRisk-friendly 0.00000000 0.00000000
## Q109244.fctrNA:.clusterid.fctr2 0.00000000 0.00000000
## Q109244.fctrNA:.clusterid.fctr3 0.00000000 0.00000000
## Q109244.fctrNo:.clusterid.fctr2 0.00000000 0.00000000
## Q109244.fctrNo:.clusterid.fctr3 0.00000000 0.00000000
## Q109244.fctrYes:.clusterid.fctr2 0.00000000 0.00000000
## Q109367.fctrNo 0.00000000 0.00000000
## Q109367.fctrYes 0.00000000 0.00000000
## Q111220.fctrNo 0.00000000 0.00000000
## Q111580.fctrDemanding 0.00000000 0.00000000
## Q111580.fctrSupportive 0.00000000 0.00000000
## Q111848.fctrNo 0.00000000 0.00000000
## Q111848.fctrYes 0.00000000 0.00000000
## Q112270.fctrYes 0.00000000 0.00000000
## Q112478.fctrYes 0.00000000 0.00000000
## Q112512.fctrNo 0.00000000 0.00000000
## Q112512.fctrYes 0.00000000 0.00000000
## Q113583.fctrTalk 0.00000000 0.00000000
## Q113584.fctrPeople 0.00000000 0.00000000
## Q113584.fctrTechnology 0.00000000 0.00000000
## Q113992.fctrNo 0.00000000 0.00000000
## Q113992.fctrYes 0.00000000 0.00000000
## Q114152.fctrNo 0.00000000 0.00000000
## Q114152.fctrYes 0.00000000 0.00000000
## Q114386.fctrMysterious 0.00000000 0.00000000
## Q114386.fctrTMI 0.00000000 0.00000000
## Q114517.fctrNo 0.00000000 0.00000000
## Q114517.fctrYes 0.00000000 0.00000000
## Q114748.fctrNo 0.00000000 0.00000000
## Q114748.fctrYes 0.00000000 0.00000000
## Q114961.fctrNo 0.00000000 0.00000000
## Q114961.fctrYes 0.00000000 0.00000000
## Q115195.fctrNo 0.00000000 0.00000000
## Q115602.fctrNo 0.00000000 0.00000000
## Q115602.fctrYes 0.00000000 0.00000000
## Q115610.fctrNo 0.00000000 0.00000000
## Q115610.fctrYes 0.00000000 0.00000000
## Q115777.fctrEnd 0.00000000 0.00000000
## Q115777.fctrStart 0.00000000 0.00000000
## Q115899.fctrMe 0.00000000 0.00000000
## Q116197.fctrA.M. 0.00000000 0.00000000
## Q116197.fctrP.M. 0.00000000 0.00000000
## Q116441.fctrNo 0.00000000 0.00000000
## Q116441.fctrYes 0.00000000 0.00000000
## Q116448.fctrNo 0.00000000 0.00000000
## Q116448.fctrYes 0.00000000 0.00000000
## Q116601.fctrNo 0.00000000 0.00000000
## Q116601.fctrYes 0.00000000 0.00000000
## Q116797.fctrNo 0.00000000 0.00000000
## Q116797.fctrYes 0.00000000 0.00000000
## Q116953.fctrYes 0.00000000 0.00000000
## Q117186.fctrCool headed 0.00000000 0.00000000
## Q117186.fctrHot headed 0.00000000 0.00000000
## Q117193.fctrOdd hours 0.00000000 0.00000000
## Q117193.fctrStandard hours 0.00000000 0.00000000
## Q118117.fctrNo 0.00000000 0.00000000
## Q118117.fctrYes 0.00000000 0.00000000
## Q118232.fctrPr 0.00000000 0.00000000
## Q118233.fctrYes 0.00000000 0.00000000
## Q118237.fctrNo 0.00000000 0.00000000
## Q118237.fctrYes 0.00000000 0.00000000
## Q118892.fctrNo 0.00000000 0.00000000
## Q118892.fctrYes 0.00000000 0.00000000
## Q119334.fctrNo 0.00000000 0.00000000
## Q119334.fctrYes 0.00000000 0.00000000
## Q119650.fctrGiving 0.00000000 0.00000000
## Q119650.fctrReceiving 0.00000000 0.00000000
## Q119851.fctrYes 0.00000000 0.00000000
## Q120012.fctrNo 0.00000000 0.00000000
## Q120012.fctrYes 0.00000000 0.00000000
## Q120014.fctrNo 0.00000000 0.00000000
## Q120014.fctrYes 0.00000000 0.00000000
## Q120194.fctrTry first 0.00000000 0.00000000
## Q120472.fctrArt 0.00000000 0.00000000
## Q120650.fctrNo 0.00000000 0.00000000
## Q120978.fctrNo 0.00000000 0.00000000
## Q120978.fctrYes 0.00000000 0.00000000
## Q121011.fctrNo 0.00000000 0.00000000
## Q121011.fctrYes 0.00000000 0.00000000
## Q121699.fctrNo 0.00000000 0.00000000
## Q121700.fctrNo 0.00000000 0.00000000
## Q121700.fctrYes 0.00000000 0.00000000
## Q122120.fctrNo 0.00000000 0.00000000
## Q122769.fctrNo 0.00000000 0.00000000
## Q122769.fctrYes 0.00000000 0.00000000
## Q122770.fctrNo 0.00000000 0.00000000
## Q122770.fctrYes 0.00000000 0.00000000
## Q122771.fctrPc 0.00000000 0.00000000
## Q123464.fctrNo 0.00000000 0.00000000
## Q123464.fctrYes 0.00000000 0.00000000
## Q123621.fctrNo 0.00000000 0.00000000
## Q123621.fctrYes 0.00000000 0.00000000
## Q124122.fctrNo 0.00000000 0.00000000
## Q124122.fctrYes 0.00000000 0.00000000
## Q124742.fctrYes 0.00000000 0.00000000
## Q96024.fctrNo 0.00000000 0.00000000
## Q96024.fctrYes 0.00000000 0.00000000
## Q98059.fctrOnly-child 0.00000000 0.00000000
## Q98059.fctrYes 0.00000000 0.00000000
## Q98078.fctrNo 0.00000000 0.00000000
## Q98078.fctrYes 0.00000000 0.00000000
## Q98578.fctrNo 0.00000000 0.00000000
## Q98578.fctrYes 0.00000000 0.00000000
## Q98869.fctrYes 0.00000000 0.00000000
## Q99581.fctrNo 0.00000000 0.00000000
## Q99581.fctrYes 0.00000000 0.00000000
## Q99716.fctrNo 0.00000000 0.00000000
## Q99716.fctrYes 0.00000000 0.00000000
## Q99982.fctrCheck! 0.00000000 0.00000000
## Q99982.fctrNope 0.00000000 0.00000000
## YOB.Age.fctr(15,20]:YOB.Age.dff 0.00000000 0.00000000
## YOB.Age.fctr(20,25]:YOB.Age.dff 0.00000000 0.00000000
## YOB.Age.fctr(25,30]:YOB.Age.dff 0.00000000 0.00000000
## YOB.Age.fctr(30,35]:YOB.Age.dff 0.00000000 0.00000000
## YOB.Age.fctr(40,50]:YOB.Age.dff 0.00000000 0.00000000
## YOB.Age.fctr(50,65]:YOB.Age.dff 0.00000000 0.00000000
## YOB.Age.fctr(65,90]:YOB.Age.dff 0.00000000 0.00000000
## YOB.Age.fctr.C 0.00000000 0.00000000
## YOB.Age.fctr.Q 0.00000000 0.00000000
## YOB.Age.fctrNA:YOB.Age.dff 0.00000000 0.00000000
## YOB.Age.fctr^4 0.00000000 0.00000000
## YOB.Age.fctr^5 0.00000000 0.00000000
## YOB.Age.fctr^6 0.00000000 0.00000000
## YOB.Age.fctr^7 0.00000000 0.00000000
## YOB.Age.fctr^8 0.00000000 0.00000000
if (glb_is_classification && glb_is_binomial)
glb_analytics_diag_plots(obs_df=glbObsTrn, mdl_id=glbMdlFinId,
prob_threshold=glb_models_df[glb_models_df$id == glbMdlSelId,
"opt.prob.threshold.OOB"]) else
glb_analytics_diag_plots(obs_df=glbObsTrn, mdl_id=glbMdlFinId)
## Warning in glb_analytics_diag_plots(obs_df = glbObsTrn, mdl_id =
## glbMdlFinId, : Limiting important feature scatter plots to 5 out of 109
## [1] "Min/Max Boundaries: "
## [1] "Inaccurate: "
## USER_ID Party.fctr Party.fctr.All.X..rcv.glmnet.prob
## 1 1309 D NA
## 2 2326 R 0.2011869
## 3 4856 R 0.1658748
## 4 722 R NA
## 5 542 R 0.2030561
## 6 3165 R 0.1883565
## Party.fctr.All.X..rcv.glmnet Party.fctr.All.X..rcv.glmnet.err
## 1 <NA> NA
## 2 D TRUE
## 3 R FALSE
## 4 <NA> NA
## 5 D TRUE
## 6 R FALSE
## Party.fctr.All.X..rcv.glmnet.err.abs Party.fctr.All.X..rcv.glmnet.is.acc
## 1 NA NA
## 2 0.2011869 FALSE
## 3 0.1658748 TRUE
## 4 NA NA
## 5 0.2030561 FALSE
## 6 0.1883565 TRUE
## Party.fctr.Final..rcv.glmnet.prob Party.fctr.Final..rcv.glmnet
## 1 0.1986153 R
## 2 0.2027961 D
## 3 0.2038816 D
## 4 0.2043311 D
## 5 0.2061211 D
## 6 0.2103140 D
## Party.fctr.Final..rcv.glmnet.err Party.fctr.Final..rcv.glmnet.err.abs
## 1 TRUE 0.8013847
## 2 TRUE 0.2027961
## 3 TRUE 0.2038816
## 4 TRUE 0.2043311
## 5 TRUE 0.2061211
## 6 TRUE 0.2103140
## Party.fctr.Final..rcv.glmnet.is.acc
## 1 FALSE
## 2 FALSE
## 3 FALSE
## 4 FALSE
## 5 FALSE
## 6 FALSE
## Party.fctr.Final..rcv.glmnet.accurate Party.fctr.Final..rcv.glmnet.error
## 1 FALSE -0.001384687
## 2 FALSE 0.002796082
## 3 FALSE 0.003881637
## 4 FALSE 0.004331107
## 5 FALSE 0.006121058
## 6 FALSE 0.010313998
## USER_ID Party.fctr Party.fctr.All.X..rcv.glmnet.prob
## 868 6050 R NA
## 1138 2290 R 0.3846047
## 1551 6713 R 0.4763564
## 1846 3222 R 0.5281053
## 2139 2173 R 0.6056192
## 2465 4258 R NA
## Party.fctr.All.X..rcv.glmnet Party.fctr.All.X..rcv.glmnet.err
## 868 <NA> NA
## 1138 D TRUE
## 1551 D TRUE
## 1846 D TRUE
## 2139 D TRUE
## 2465 <NA> NA
## Party.fctr.All.X..rcv.glmnet.err.abs
## 868 NA
## 1138 0.3846047
## 1551 0.4763564
## 1846 0.5281053
## 2139 0.6056192
## 2465 NA
## Party.fctr.All.X..rcv.glmnet.is.acc Party.fctr.Final..rcv.glmnet.prob
## 868 NA 0.4182703
## 1138 FALSE 0.4557550
## 1551 FALSE 0.5067147
## 1846 FALSE 0.5320086
## 2139 FALSE 0.5640040
## 2465 NA 0.7137498
## Party.fctr.Final..rcv.glmnet Party.fctr.Final..rcv.glmnet.err
## 868 D TRUE
## 1138 D TRUE
## 1551 D TRUE
## 1846 D TRUE
## 2139 D TRUE
## 2465 D TRUE
## Party.fctr.Final..rcv.glmnet.err.abs
## 868 0.4182703
## 1138 0.4557550
## 1551 0.5067147
## 1846 0.5320086
## 2139 0.5640040
## 2465 0.7137498
## Party.fctr.Final..rcv.glmnet.is.acc
## 868 FALSE
## 1138 FALSE
## 1551 FALSE
## 1846 FALSE
## 2139 FALSE
## 2465 FALSE
## Party.fctr.Final..rcv.glmnet.accurate
## 868 FALSE
## 1138 FALSE
## 1551 FALSE
## 1846 FALSE
## 2139 FALSE
## 2465 FALSE
## Party.fctr.Final..rcv.glmnet.error
## 868 0.2182703
## 1138 0.2557550
## 1551 0.3067147
## 1846 0.3320086
## 2139 0.3640040
## 2465 0.5137498
## USER_ID Party.fctr Party.fctr.All.X..rcv.glmnet.prob
## 2607 2749 R NA
## 2608 1236 R 0.8969807
## 2609 1515 R 0.9093130
## 2610 468 R NA
## 2611 626 R NA
## 2612 3895 R NA
## Party.fctr.All.X..rcv.glmnet Party.fctr.All.X..rcv.glmnet.err
## 2607 <NA> NA
## 2608 D TRUE
## 2609 D TRUE
## 2610 <NA> NA
## 2611 <NA> NA
## 2612 <NA> NA
## Party.fctr.All.X..rcv.glmnet.err.abs
## 2607 NA
## 2608 0.8969807
## 2609 0.9093130
## 2610 NA
## 2611 NA
## 2612 NA
## Party.fctr.All.X..rcv.glmnet.is.acc Party.fctr.Final..rcv.glmnet.prob
## 2607 NA 0.8707835
## 2608 FALSE 0.8713689
## 2609 FALSE 0.8760113
## 2610 NA 0.8828678
## 2611 NA 0.8902760
## 2612 NA 0.8939128
## Party.fctr.Final..rcv.glmnet Party.fctr.Final..rcv.glmnet.err
## 2607 D TRUE
## 2608 D TRUE
## 2609 D TRUE
## 2610 D TRUE
## 2611 D TRUE
## 2612 D TRUE
## Party.fctr.Final..rcv.glmnet.err.abs
## 2607 0.8707835
## 2608 0.8713689
## 2609 0.8760113
## 2610 0.8828678
## 2611 0.8902760
## 2612 0.8939128
## Party.fctr.Final..rcv.glmnet.is.acc
## 2607 FALSE
## 2608 FALSE
## 2609 FALSE
## 2610 FALSE
## 2611 FALSE
## 2612 FALSE
## Party.fctr.Final..rcv.glmnet.accurate
## 2607 FALSE
## 2608 FALSE
## 2609 FALSE
## 2610 FALSE
## 2611 FALSE
## 2612 FALSE
## Party.fctr.Final..rcv.glmnet.error
## 2607 0.6707835
## 2608 0.6713689
## 2609 0.6760113
## 2610 0.6828678
## 2611 0.6902760
## 2612 0.6939128
dsp_feats_vctr <- c(NULL)
for(var in grep(".imp", names(glb_feats_df), fixed=TRUE, value=TRUE))
dsp_feats_vctr <- union(dsp_feats_vctr,
glb_feats_df[!is.na(glb_feats_df[, var]), "id"])
# print(glbObsTrn[glbObsTrn$UniqueID %in% FN_OOB_ids,
# grep(glb_rsp_var, names(glbObsTrn), value=TRUE)])
print(setdiff(names(glbObsTrn), names(glbObsAll)))
## [1] "Party.fctr.Final..rcv.glmnet.prob"
## [2] "Party.fctr.Final..rcv.glmnet"
## [3] "Party.fctr.Final..rcv.glmnet.err"
## [4] "Party.fctr.Final..rcv.glmnet.err.abs"
## [5] "Party.fctr.Final..rcv.glmnet.is.acc"
for (col in setdiff(names(glbObsTrn), names(glbObsAll)))
# Merge or cbind ?
glbObsAll[glbObsAll$.src == "Train", col] <- glbObsTrn[, col]
print(setdiff(names(glbObsFit), names(glbObsAll)))
## character(0)
print(setdiff(names(glbObsOOB), names(glbObsAll)))
## character(0)
for (col in setdiff(names(glbObsOOB), names(glbObsAll)))
# Merge or cbind ?
glbObsAll[glbObsAll$.lcn == "OOB", col] <- glbObsOOB[, col]
print(setdiff(names(glbObsNew), names(glbObsAll)))
## character(0)
#glb2Sav(); all.equal(savObsAll, glbObsAll); all.equal(sav_models_lst, glb_models_lst)
#load(file = paste0(glbOut$pfx, "dsk_knitr.RData"))
#cmpCols <- names(glbObsAll)[!grepl("\\.Final\\.", names(glbObsAll))]; all.equal(savObsAll[, cmpCols], glbObsAll[, cmpCols]); all.equal(savObsAll[, "H.P.http"], glbObsAll[, "H.P.http"]);
replay.petrisim(pn = glb_analytics_pn,
replay.trans = (glb_analytics_avl_objs <- c(glb_analytics_avl_objs,
"data.training.all.prediction","model.final")), flip_coord = TRUE)
## time trans "bgn " "fit.data.training.all " "predict.data.new " "end "
## 0.0000 multiple enabled transitions: data.training.all data.new model.selected firing: data.training.all
## 1.0000 1 2 1 0 0
## 1.0000 multiple enabled transitions: data.training.all data.new model.selected model.final data.training.all.prediction firing: data.new
## 2.0000 2 1 1 1 0
## 2.0000 multiple enabled transitions: data.training.all data.new model.selected model.final data.training.all.prediction data.new.prediction firing: model.selected
## 3.0000 3 0 2 1 0
## 3.0000 multiple enabled transitions: model.final data.training.all.prediction data.new.prediction firing: data.training.all.prediction
## 4.0000 5 0 1 1 1
## 4.0000 multiple enabled transitions: model.final data.training.all.prediction data.new.prediction firing: model.final
## 5.0000 4 0 0 2 1
glb_chunks_df <- myadd_chunk(glb_chunks_df, "predict.data.new", major.inc = TRUE)
## label step_major step_minor label_minor bgn end
## 21 fit.data.training 9 1 1 759.534 769.389
## 22 predict.data.new 10 0 0 769.389 NA
## elapsed
## 21 9.855
## 22 NA
10.0: predict data new## Warning in glb_get_predictions(obs_df, mdl_id = glbMdlFinId, rsp_var =
## glb_rsp_var, : Using default probability threshold: 0.2
## Warning in glb_get_predictions(obs_df, mdl_id = glbMdlFinId, rsp_var =
## glb_rsp_var, : Using default probability threshold: 0.2
## Warning in glb_analytics_diag_plots(obs_df = glbObsNew, mdl_id =
## glbMdlFinId, : Limiting important feature scatter plots to 5 out of 109
## Warning: Removed 1392 rows containing missing values (geom_point).
## Warning: Removed 1392 rows containing missing values (geom_point).
## Warning: Removed 1392 rows containing missing values (geom_point).
## Warning: Removed 1392 rows containing missing values (geom_point).
## Warning: Removed 1392 rows containing missing values (geom_point).
## Warning: Removed 1392 rows containing missing values (geom_point).
## Warning: Removed 1392 rows containing missing values (geom_point).
## Warning: Removed 1392 rows containing missing values (geom_point).
## Warning: Removed 1392 rows containing missing values (geom_point).
## Warning: Removed 1392 rows containing missing values (geom_point).
## NULL
## [1] "OOBobs total range outliers: 0"
## [1] "newobs total range outliers: 0"
## [1] 0.2
## [1] "glbMdlSelId: All.X##rcv#glmnet"
## [1] "glbMdlFinId: Final##rcv#glmnet"
## [1] "Cross Validation issues:"
## MFO###myMFO_classfr Random###myrandom_classfr
## 0 0
## Max.cor.Y.rcv.1X1###glmnet
## 0
## max.Accuracy.OOB max.AUCROCR.OOB
## All.X##rcv#glm 0.5354260 0.4500685
## Low.cor.X##rcv#glmnet 0.5345291 0.4412078
## All.X##rcv#glmnet 0.5345291 0.4412078
## Random###myrandom_classfr 0.5300448 0.5178149
## MFO###myMFO_classfr 0.5300448 0.5000000
## Max.cor.Y##rcv#rpart 0.5300448 0.4999354
## Max.cor.Y.rcv.1X1###glmnet 0.5300448 0.4910312
## Interact.High.cor.Y##rcv#glmnet 0.5300448 0.4731743
## Final##rcv#glmnet NA NA
## max.AUCpROC.OOB max.Accuracy.fit
## All.X##rcv#glm 0.5360836 0.6305879
## Low.cor.X##rcv#glmnet 0.5457838 0.6543941
## All.X##rcv#glmnet 0.5457838 0.6543941
## Random###myrandom_classfr 0.5268661 0.5299798
## MFO###myMFO_classfr 0.5000000 0.5299798
## Max.cor.Y##rcv#rpart 0.4999322 0.6227314
## Max.cor.Y.rcv.1X1###glmnet 0.4999322 0.5299798
## Interact.High.cor.Y##rcv#glmnet 0.5157790 0.6276719
## Final##rcv#glmnet NA 0.6343376
## opt.prob.threshold.fit
## All.X##rcv#glm 0.40
## Low.cor.X##rcv#glmnet 0.45
## All.X##rcv#glmnet 0.45
## Random###myrandom_classfr 0.00
## MFO###myMFO_classfr 0.00
## Max.cor.Y##rcv#rpart 0.00
## Max.cor.Y.rcv.1X1###glmnet 0.00
## Interact.High.cor.Y##rcv#glmnet 0.35
## Final##rcv#glmnet 0.40
## opt.prob.threshold.OOB
## All.X##rcv#glm 0.1
## Low.cor.X##rcv#glmnet 0.2
## All.X##rcv#glmnet 0.2
## Random###myrandom_classfr 0.0
## MFO###myMFO_classfr 0.0
## Max.cor.Y##rcv#rpart 0.0
## Max.cor.Y.rcv.1X1###glmnet 0.0
## Interact.High.cor.Y##rcv#glmnet 0.0
## Final##rcv#glmnet NA
## [1] "All.X##rcv#glmnet OOB confusion matrix & accuracy: "
## Prediction
## Reference R D
## R 7 517
## D 2 589
## err.abs.fit.sum err.abs.OOB.sum err.abs.trn.sum err.abs.new.sum
## No 878.1282 243.00394 1134.7582 NA
## NA 827.6624 211.30802 1046.9636 NA
## Yes 195.3430 83.68265 296.3566 NA
## .freqRatio.Fit .freqRatio.OOB .freqRatio.Tst .n.Fit .n.New.D .n.OOB
## No 0.4403773 0.4466368 0.4468391 1961 622 498
## NA 0.3920952 0.3928251 0.3929598 1746 547 438
## Yes 0.1675275 0.1605381 0.1602011 746 223 179
## .n.Trn.D .n.Trn.R .n.Tst .n.fit .n.new .n.trn err.abs.OOB.mean
## No 1038 1421 622 1961 622 2459 0.4879597
## NA 1171 1013 547 1746 547 2184 0.4824384
## Yes 742 183 223 746 223 925 0.4675009
## err.abs.fit.mean err.abs.new.mean err.abs.trn.mean
## No 0.4477961 NA 0.4614714
## NA 0.4740334 NA 0.4793790
## Yes 0.2618539 NA 0.3203855
## err.abs.fit.sum err.abs.OOB.sum err.abs.trn.sum err.abs.new.sum
## 1901.133610 537.994617 2478.078382 NA
## .freqRatio.Fit .freqRatio.OOB .freqRatio.Tst .n.Fit
## 1.000000 1.000000 1.000000 4453.000000
## .n.New.D .n.OOB .n.Trn.D .n.Trn.R
## 1392.000000 1115.000000 2951.000000 2617.000000
## .n.Tst .n.fit .n.new .n.trn
## 1392.000000 4453.000000 1392.000000 5568.000000
## err.abs.OOB.mean err.abs.fit.mean err.abs.new.mean err.abs.trn.mean
## 1.437899 1.183683 NA 1.261236
## [1] "Features Importance for selected models:"
## All.X..rcv.glmnet.imp
## Q109244.fctrYes 100.000000
## Q109244.fctrYes:.clusterid.fctr3 74.835242
## Hhold.fctrPKn 56.071662
## Q109244.fctrNo 48.626667
## Q115611.fctrYes 32.554511
## Q98869.fctrNo 29.598710
## Q113181.fctrYes 19.945846
## Q98197.fctrNo 19.080380
## Q116881.fctrRight 18.351596
## Q109244.fctrYes:.clusterid.fctr2 16.585199
## Q99480.fctrNo 14.261454
## Q98197.fctrYes 14.100507
## Income.fctr.Q 13.865996
## Q113181.fctrNo 13.820565
## Q101163.fctrDad 13.752046
## Q115611.fctrNo 13.558369
## Q122771.fctrPt 11.722236
## Q118232.fctrId 11.716064
## YOB.Age.fctr.L 11.678989
## Gender.fctrM 11.262268
## Q100689.fctrYes 11.072153
## Hhold.fctrMKy 10.888875
## Hhold.fctrSKy 10.850770
## Q119851.fctrYes 10.550445
## Q120472.fctrScience 9.303878
## Q119851.fctrNo 8.821774
## Q120379.fctrYes 8.727640
## Final..rcv.glmnet.imp
## Q109244.fctrYes 100.000000
## Q109244.fctrYes:.clusterid.fctr3 56.546670
## Hhold.fctrPKn 45.491369
## Q109244.fctrNo 41.177048
## Q115611.fctrYes 39.956092
## Q98869.fctrNo 22.740793
## Q113181.fctrYes 20.562979
## Q98197.fctrNo 34.478094
## Q116881.fctrRight 19.905403
## Q109244.fctrYes:.clusterid.fctr2 0.000000
## Q99480.fctrNo 4.106947
## Q98197.fctrYes 2.220137
## Income.fctr.Q 6.526245
## Q113181.fctrNo 13.885529
## Q101163.fctrDad 10.773819
## Q115611.fctrNo 14.708271
## Q122771.fctrPt 9.961533
## Q118232.fctrId 11.705320
## YOB.Age.fctr.L 7.033688
## Gender.fctrM 13.406944
## Q100689.fctrYes 9.096181
## Hhold.fctrMKy 11.335513
## Hhold.fctrSKy 0.000000
## Q119851.fctrYes 0.000000
## Q120472.fctrScience 10.287836
## Q119851.fctrNo 12.485970
## Q120379.fctrYes 10.831632
## [1] "glbObsNew prediction stats:"
##
## R D
## 0 1392
## label step_major step_minor label_minor bgn end
## 22 predict.data.new 10 0 0 769.389 785.602
## 23 display.session.info 11 0 0 785.603 NA
## elapsed
## 22 16.213
## 23 NA
Null Hypothesis (\(\sf{H_{0}}\)): mpg is not impacted by am_fctr.
The variance by am_fctr appears to be independent. #{r q1, cache=FALSE} # print(t.test(subset(cars_df, am_fctr == "automatic")$mpg, # subset(cars_df, am_fctr == "manual")$mpg, # var.equal=FALSE)$conf) # We reject the null hypothesis i.e. we have evidence to conclude that am_fctr impacts mpg (95% confidence). Manual transmission is better for miles per gallon versus automatic transmission.
## label step_major step_minor label_minor bgn
## 2 inspect.data 2 0 0 25.772
## 13 cluster.data 5 0 0 246.897
## 14 partition.data.training 6 0 0 408.645
## 16 fit.models 8 0 0 543.189
## 17 fit.models 8 1 1 622.314
## 3 scrub.data 2 1 1 199.225
## 20 fit.data.training 9 0 0 720.504
## 22 predict.data.new 10 0 0 769.389
## 18 fit.models 8 2 2 700.378
## 1 import.data 1 0 0 11.959
## 21 fit.data.training 9 1 1 759.534
## 15 select.features 7 0 0 536.122
## 19 fit.models 8 3 3 715.663
## 11 extract.features.end 3 6 6 244.861
## 12 manage.missing.data 4 0 0 245.948
## 10 extract.features.string 3 5 5 244.785
## 7 extract.features.image 3 2 2 244.617
## 9 extract.features.text 3 4 4 244.722
## 4 transform.data 2 2 2 244.502
## 6 extract.features.datetime 3 1 1 244.575
## 8 extract.features.price 3 3 3 244.680
## 5 extract.features 3 0 0 244.550
## end elapsed duration
## 2 199.224 173.453 173.452
## 13 408.644 161.748 161.747
## 14 536.122 127.477 127.477
## 16 622.313 79.124 79.124
## 17 700.377 78.063 78.063
## 3 244.501 45.277 45.276
## 20 759.533 39.029 39.029
## 22 785.602 16.213 16.213
## 18 715.662 15.284 15.284
## 1 25.772 13.813 13.813
## 21 769.389 9.855 9.855
## 15 543.189 7.067 7.067
## 19 720.504 4.841 4.841
## 11 245.947 1.086 1.086
## 12 246.897 0.949 0.949
## 10 244.860 0.076 0.075
## 7 244.679 0.062 0.062
## 9 244.784 0.062 0.062
## 4 244.550 0.048 0.048
## 6 244.616 0.042 0.041
## 8 244.721 0.041 0.041
## 5 244.575 0.025 0.025
## [1] "Total Elapsed Time: 785.602 secs"